Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
XP / JBoss Portal 2.21RC2 / JDK5
Description
The problem is, that the sessionTimeout(...) detector method does not work properly, because there is always as session in this jboss context - and I think under many more application servers...
This is the solution (as part of a subclass I made from MyFacesGenericPortlet:
protected void facesRender(RenderRequest request, RenderResponse response) throws PortletException, java.io.IOException {
if (log.isTraceEnabled())
log.trace("called facesRender");
setContentType(request, response);
//////////////////////////////////////////////////// MODIFIED
String viewId = request.getParameter(VIEW_ID);
boolean nonFacesRequest = (viewId == null) || sessionTimedOut(request);
request.getPortletSession(true).setAttribute(SESSION_LIVE_ATTR, Boolean.TRUE); /////// say we are alive
if (nonFacesRequest)
setPortletRequestFlag(request);
try {
ServletFacesContextImpl facesContext = (ServletFacesContextImpl) request.getPortletSession().getAttribute(CURRENT_FACES_CONTEXT);
if (facesContext == null)
// TODO: not sure if this can happen. Also double check this against
// spec section 2.1.3
if (facesContext.getResponseComplete())
return;
facesContext.setExternalContext(makeExternalContext(request, response));
lifecycle.render(facesContext);
} catch (Throwable e)
}
protected boolean sessionTimedOut(PortletRequest request) {
if (super.sessionTimedOut(request))
return true;
Object flag = request.getPortletSession(false).getAttribute(SESSION_LIVE_ATTR);
return flag == null;
}