3 Replies Latest reply on Dec 6, 2012 8:49 AM by Ken Finnigan

    problem accessing httpSession

    Laurent Taraud Newbie

      Hi,

       

      I'm trying to access httpSession parameters from the method public void serveResource(ResourceRequest request, ResourceResponse response) throws PortletException, IOException {}

       

      request.getPortletSession(false).getAttribute(DATA_KEY, PortletSession.APPLICATION_SCOPE);  returns null but the data is present in the HTTPSession

       

      Using getAttributeNames(PortletSession.APPLICATION_SCOPE), I have only data with javax.portlet.* keys like javax.portlet.p.p_5f888a85-db04-41dd-8189-951404450bfe?beanCmpNav

       

      So the keys are right in the Session scope, but only attributes from the portlet scope are visible.

       

      How can I access to data, located in the HttpSession, to share them with HttpServlets ?

       

      Thanks,

       

      Laurent

       

      -- using gtn 3.2.4 (eXo 3.5.3) / Tomcat 6 ---

       

      Note : https://community.jboss.org/message/539407 // https://jira.jboss.org/jira/browse/GTNPORTAL-1118 is fixed (gtn 3.1.0)

        • 1. Re: problem accessing httpSession
          Vu Viet Phuong Novice

          Hi, can you give more details about how you save an get the session attribute ? Note that in this thread https://community.jboss.org/message/539407 they said that

          - The portlets are all in the same .war

          - Portlet A sets the value

               portletSession.setAttribute("var","value",PortletSession.APPLICATION_SCOPE)

          - Portlet B gets the value

               portletSession.getAttribute("var",PortletSession.APPLICATION_SCOPE)

           

          Is that the same to your case ?

          • 2. Re: problem accessing httpSession
            Laurent Taraud Newbie

            Hi,

             

            I'm using theses methods.

             

            Each portlet has his own War file.

             

            Using the debuger, I see that :

            - the portal has his own HttpSession

            - each portlet has his own HttpSession

             

            Thats why one portlet can't see data from an other portlet, looking at his httpSession

             

            Do I need to add a configuration in a file (portlet.xml, server.xml, ...) to share the same httpSession ?

             

            I realy need to share states and data between a lots of portlet.

            IPC are not enough because Portlet active but not displayed doesn't receive the events. The next time theses porltet would be displayed, they must be up to date.

             

            How can I do it ?

             

            Thanks.

             

            Laurent

             

             

             

            • 3. Re: problem accessing httpSession
              Ken Finnigan Master

              Laurent,

               

              As mentioned here, your problem is a result of each servlet container, or WAR, having their own HttpSession even for the same user.

               

              Ken