// during the session so the session view of the site can
// be cached unless locators do change; if the context
// is invalid, (perhaps because the session was persisted
// and is now being reloaded in a new server), it must be
// replaced with a newly created session context
PortalSiteSessionContext sessionContext = (PortalSiteSessionContext)request.getSessionAttribute(PORTAL_SITE_SESSION_CONTEXT_ATTR_KEY);
if ((sessionContext == null) || !sessionContext.isValid())
{
sessionContext = portalSite.newSessionContext();
request.setSessionAttribute(PORTAL_SITE_SESSION_CONTEXT_ATTR_KEY, sessionContext);
}
// construct and save a new portal site request context
// using session context, locators map, fallback, and
// folder page histories; the request context uses the
// locators to initialize or resets the session context if
// locators have changed for this request; the request
// context also acts as a short term request cache for the
// selected page and built menus; however, creating the
// request context here does not select the page or build
// menus: that is done when the request context is
// accessed subsequently
String pipeline = request.getPipeline().getName();
boolean forceReservedFoldersVisible = (pipeline.equals(PortalReservedParameters.CONFIG_PIPELINE_NAME) ||
pipeline.equals(PortalReservedParameters.DESKTOP_CONFIG_PIPELINE_NAME));
PortalSiteRequestContext requestContext = sessionContext.newRequestContext(locators, requestUserPrincipal.getName(), requestFallback, useHistory, forceReservedFoldersVisible, true);
// save request context and set request page from portal
// site request context
setRequestPage(request, requestPath, requestContext);
}