Search in sources :

Example 1 with SessionInitImpl

use of au.org.emii.portal.web.SessionInitImpl in project spatial-portal by AtlasOfLivingAustralia.

the class MapComposer method reloadPortal.

/**
     * split from button for yes/no event processing
     * <p/>
     * see onClick$reloadPortal()
     */
void reloadPortal() {
    // grab the portaluser instance so that logged in users stay logged in...
    PortalSession portalSession = getPortalSession();
    // remove the old species filters
    getSession().removeAttribute("speciesfilters");
    // create a new session from the master session
    SessionInit sessionInit = new SessionInitImpl();
    try {
        sessionInit.init(Sessions.getCurrent(), null);
    } catch (Exception ex) {
        LOGGER.error("Error creating replacement session information after user clicked reload portal", ex);
    }
    // check PortalSession is not null - if it is, something is badly wrong
    // so redirect to error page
    portalSession = getPortalSession();
    if (portalSession == null) {
        LOGGER.error("Null portal session created after clicking reset map, sending user to error page");
        try {
            Executions.getCurrent().forward("/WEB-INF/jsp/Error.jsp");
        } catch (IOException ex) {
            LOGGER.error("error redirecting to error page", ex);
        }
    } else {
        // all good - put the portal user back in, then force a page reload
        Executions.getCurrent().sendRedirect(CommonData.getWebportalServer() + "/");
    }
}
Also used : PortalSession(au.org.emii.portal.session.PortalSession) SessionInitImpl(au.org.emii.portal.web.SessionInitImpl) SessionInit(org.zkoss.zk.ui.util.SessionInit) ParseException(org.json.simple.parser.ParseException)

Aggregations

PortalSession (au.org.emii.portal.session.PortalSession)1 SessionInitImpl (au.org.emii.portal.web.SessionInitImpl)1 ParseException (org.json.simple.parser.ParseException)1 SessionInit (org.zkoss.zk.ui.util.SessionInit)1