use of au.org.emii.portal.config.ConfigurationLoaderStage1Impl in project spatial-portal by AtlasOfLivingAustralia.
the class SessionInitImpl method init.
@Override
public void init(Session session, Object request) throws Exception {
LOGGER.debug("* SESSION INIT:");
// obtain stage1 loader - check for errors
ConfigurationLoaderStage1Impl stage1 = getConfigurationLoaderStage1(session);
// wait for portal to finish if its reloading
waitForPortalReload(stage1, session);
/*if (stage1.isReloading()) {
// portal is taking too long to load - MAX_TIME_RELOADING_SECONDS exceeded!
redirectAndInvalidateSession(session, "/WEB-INF/jsp/Reloading.jsp");
} else*/
if (stage1.isError()) {
// portal reloaded but has errors
redirectAndInvalidateSession(session, ERROR_PAGE);
} else {
// see if there is a master session
PortalSession masterPortalSession = getMasterPortalSession(session);
if (masterPortalSession == null) {
// hmm master portal session never got created - don't know why, check
// output for previous errors
LOGGER.error("masterPortalSession is null - redirecting user to error page");
// redirect to error page - nothing we can do and portal doesn't look to
// be coming up any time soon
redirectAndInvalidateSession(session, ERROR_PAGE);
} else {
// all good :-D
// deep copy of PortalSession - otherwise you will be sharing state with everybody
// after cloning, save a the independent clone in SESSION scope
PortalSessionCloner cloner = getPortalSessionCloner(session);
PortalSession portalSession = cloner.clone(masterPortalSession);
session.setAttribute(PORTAL_SESSION_ATTRIBUTE, portalSession);
LOGGER.debug("* SESSION INIT OK");
}
}
}
Aggregations