You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Martin Schmidt (JIRA)" <de...@myfaces.apache.org> on 2006/02/22 19:54:07 UTC
[jira] Created: (MYFACES-1150) NullpointerException in
MyFacesGenericPortlet after action-invocation
NullpointerException in MyFacesGenericPortlet after action-invocation
---------------------------------------------------------------------
Key: MYFACES-1150
URL: http://issues.apache.org/jira/browse/MYFACES-1150
Project: MyFaces Core
Type: Bug
Environment: XP / JBoss Portal 2.21RC2 / JDK5
Reporter: Martin Schmidt
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);
nonFacesRequest(request, response);
return;
}
setPortletRequestFlag(request);
try {
ServletFacesContextImpl facesContext = (ServletFacesContextImpl) request.getPortletSession().getAttribute(CURRENT_FACES_CONTEXT);
if (facesContext == null) {
facesContext = (ServletFacesContextImpl) facesContext(request, response);
request.getPortletSession().setAttribute(CURRENT_FACES_CONTEXT, facesContext);
}
// 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) {
handleExceptionFromLifecycle(e);
}
}
protected boolean sessionTimedOut(PortletRequest request) {
if (super.sessionTimedOut(request))
return true;
Object flag = request.getPortletSession(false).getAttribute(SESSION_LIVE_ATTR);
return flag == null;
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira