Uploaded image for project: 'MyFaces Tomahawk'
  1. MyFaces Tomahawk
  2. TOMAHAWK-154

NullpointerException in MyFacesGenericPortlet after action-invocation

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Portlet_Support
    • 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); 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;
      }

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            martplus Martin Schmidt

            Dates

              Created:
              Updated:

              Slack

                Issue deployment