use of org.zkoss.zk.ui.util.SessionInit 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() + "/");
}
}
Aggregations