1 Reply Latest reply on Nov 29, 2007 2:53 AM by bvogt

    Session objects in PageCustomizerInterceptor and jsp/servlet

    bvogt

      We need to pass data from a page (declared property) to a ThemeTagHandler.

      In portal 2.4.1 it works by extracting the declared property in a portlet context , passing it via:

      PortletRequest.getPortletSession().setAttribute(attributeName, attributeValue, PortletSession.APPLICATION_SCOPE)

      and retrieving it in the ThemeTagHandler by:
      ((PageContext)getJspContext()).getSession().getAttribute(attributeName)


      In portal 2.6.2 this works too, but in order to reduce our portlets we decided to move their functionality to a custom PageCustomizerInterceptor.
      In this context it seems, that session objects defined by:
      ((PageCommand) cmd).getControllerContext().getServerInvocation().getServerContext().getClientRequest().getSession().setAttribute(attributeName, attributeValue);

      are not "visiible" in either portlet or servlet/jsp context although the session ids are the same in each context.

      I guess the reason is the same as for: http://jboss.org/index.html?module=bb&op=viewtopic&t=123276

      Has anyone an idea how to bypass this behaviour?

      Thanks for any hints in advance!

        • 1. Re: Session objects in PageCustomizerInterceptor and jsp/ser
          bvogt

          I got at least a workaround:

          Portlets:
          Needed to be derived from:

          org.jboss.portlet.JBossPortlet

          in order to access the objects by:
          JBossRenderRequest.getControllerContext().getServerInvocation().getServerContext().getClientRequest().getSession().getAttribute(attributeName);


          Custom ThemeTagHandler / Theme's index.jsp:
          Change the objects visibility from session to request and pass it in custom PageCustomizerInterceptor by:
          pageCommand.setAttribute(ControllerCommand.REQUEST_SCOPE, attributeName, attributeValue);

          and retrieve the object in custom ThemeTagHandler:
          ((PageContext)getJspContext()).getRequest().getAttribute(attributeName);

          or the theme's index.jsp:
          request.getAttribute(attributeName);