// if (sessionTimedOut(request)) return;
boolean isSessionTimeOut = sessionTimedOut(request);
setPortletRequestFlag(request);
ServletFacesContextImpl facesContext = (ServletFacesContextImpl) facesContext(request, response);
if (isSessionTimeOut) {
ApplicationFactory appFactory =
(ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
Application application = appFactory.getApplication();
ViewHandler viewHandler = application.getViewHandler();
String viewId = (String) facesContext.getExternalContext().getRequestParameterMap().get("jsf_viewid");
UIViewRoot viewRoot = viewHandler.createView(facesContext, viewId);
viewRoot.setViewId(viewId);
facesContext.setViewRoot(viewRoot);
if (!facesContext.getResponseComplete()) {
response.setRenderParameter(VIEW_ID, viewId);
}
try {
if (facesContext.getResponseComplete()) return;
facesContext.setExternalContext(makeExternalContext(request, response));
request.getPortletSession().setAttribute(CURRENT_FACES_CONTEXT, facesContext);
}
catch (Throwable e) {
handleExceptionFromLifecycle(e);
}
} else {
try {
lifecycle.execute(facesContext);
if (!facesContext.getResponseComplete()) {
response.setRenderParameter(VIEW_ID, facesContext.getViewRoot().getViewId());
}
request.getPortletSession().setAttribute(CURRENT_FACES_CONTEXT, facesContext);
}
catch (Throwable e) {
facesContext.release();
handleExceptionFromLifecycle(e);
}
}
}