1 Reply Latest reply on Jan 12, 2007 12:59 PM by klj62

    LayoutStrategy HttpSession and PortletSession with APPLICATI

      We are currently using the JBoss Portal 2.2.1SP3 Bundle and are attempting to set a session attribute in a portlet for access by a layout strategy, which has access to the HttpSession.

      Yes, we've read the spec and are using APPLICATION_SCOPE. Both the layout strategy class and the portlet class are deployed in the same web app. The Portlet code is:

      public void processAction(ActionRequest actionRequest, ActionResponse actionResponse)
       throws PortletException
       {
       PortletSession ps = actionRequest.getPortletSession();
       ps.setAttribute( "portletAction", "MyPortletInfo", PortletSession.APPLICATION_SCOPE );
       }
      


      Then the Strategy code called immediately after is:

      public StrategyResponse evaluate(StrategyContext context)
       throws StrategyException
       {
       HttpServletRequest request = context.getHttpServletRequest();
       HttpSession session = request.getSession();
      
       String portletAction = (String)session.getAttribute("portletAction");
       . . . .
       }
      


      The attribute is not found. We've printed all attributes available from the HttpSession, and the "portletAction" set in the PortletSession is not found, regardless of the scope used.

      Are there any versions of Jboss/Tomcat that do not properly propagate PortletSession attributes to the HttpSession? Is the Strategy called by some external HttpSession to the one used by the portlets? Are there configuration parameters that do not default to work according to the JSR168 spec?


        • 1. Re: LayoutStrategy HttpSession and PortletSession with APPLI


          I have further refined this and have concluded that it is a JBoss bug, but haven't narrowed it down to JBoss Portal (2.2.1SP3) or the AS (4.0.4GA).

          I added a session attribute listener and printed the session ID when attributes were added from both the portlet and from the strategy class. The session IDs in all three places (portlet class, strategy class, and listener class) were the same. But the original problem is that the attributes added in the portlet in APPLICATION_SCOPE cannot be found by the strategy class. Printing the object and tracing a little in Eclipse showed that the StandardSessionFacade object behind the session retrieved was different, but contained the same session ID.

          The attributes attached to each session object are mutually exclusive, which is a little confusing since they have the same session ID, and are supposed to be accessible.

          Does anyone know if this bug is fixed in JBoss Portal 2.4? Can this be fixed easily in the 2.2.1SP3 code?