3 Replies Latest reply on Dec 7, 2012 11:36 AM by drwho

    Gatein Simple Portal and Portal <-> Portlet Communication

    nias

      hello,

       

      I'm searching for a way to access an attribute which was set in a specific portlet (session-aware) from the portal (jsp-Tag or jsp-page).

      in detail:

      a user selects an option in a portlet, the portlet save this selection into the PortletSession (application scope).

       

      Then the portal-Page should read this attribute and render the portal-page according to this variable differently.

       

      I've tried to get the value from the Portal-HttpSession object, but the PortletSession objects was not there, looks like they will be saved anywhere else...i've tried to debug the Portal to see where the PortletSession was injected during a portlet-render call, but still without luck.

       

      anybody knows a way to access the PortletSession from the portal-page?

        • 1. Re: Gatein Simple Portal and Portal <-> Portlet Communication
          snarasimhan

          Hi Markus,

           

          I guess, you'd have found a solution by now. If not, make sure u have mentioned the scope of the variable while accessing the session variable in the jsp.

           

          For instance if u have set a session variable with application scope then make sure u retrieve it as renderRequest.getPortletSession().getAttribute("var",PortletSession.APPLICATION_SCOPE); as it returns Null if we do not mention the scope of the variable. Hope it was useful.

           

          Suhas

          • 2. Re: Gatein Simple Portal and Portal <-> Portlet Communication
            nias

            i've solved it a different way (APPLICATION_SCOPE works only for portlets inside the same war/ear, and additional i want to access the session from Portal [not a portlet]).

             

            now i have written a ServletReqListener which put the HttpSession from the Portal into a static-ThreadLocal Class-Member. With this one i can access the Portal-HttpSession from each portlet.

            Works fine and now i have a <portal:maincontent> tag for the simple-gatein-portal which renders the selected portlet (read from global session).

            Thanks to JSF-statefullness i can change portlets like an application-switcher (change back to a jsf-portlet restores last view).

            • 3. Re: Gatein Simple Portal and Portal <-> Portlet Communication
              drwho

              Hey Markus

              Can you share your solution with me? I am trying to do the same thing...

              Let me know so I can give me my private email address for communication..

              Thanks,   Gordon