1 Reply Latest reply on Oct 12, 2007 4:27 AM by theute

    BUG with portlet session

    frontline2

      If I have two portlets on a page (same portlets and instances as defined in *-object-xml) in two different "windows", their sessions get mixed before both portlets are "used" (ie. called with an url that sends request to a specific portlet on the page).

      The portlet contains:

      System.out.println("###");
       System.out.println("request: "+rRequest.getParameter("id"));
       System.out.println("session: "+rRequest.getPortletSession().getAttribute("id", PortletSession.PORTLET_SCOPE));
       if ( rRequest.getParameter("id")!=null) {
       rRequest.getPortletSession().setAttribute("id", rRequest.getParameter("id"), PortletSession.PORTLET_SCOPE);
       }
      


      When I first access the page with two of these portlets I get the following (no query parameters), everything normal:
      23:46:35,093 INFO [STDOUT] ###
      23:46:35,093 INFO [STDOUT] request: null
      23:46:35,093 INFO [STDOUT] session: null
      23:46:35,203 INFO [STDOUT] ###
      23:46:35,203 INFO [STDOUT] request: null
      23:46:35,203 INFO [STDOUT] session: null


      Then I access an url like: /portal/portal/default/TEST/Test1?action=2&id=1
      (the page is TEST and one of the windows is Test1). I get:
      23:47:20,640 INFO [STDOUT] ###
      23:47:20,640 INFO [STDOUT] request: null
      23:47:20,640 INFO [STDOUT] session: null
      23:47:20,640 INFO [STDOUT] ###
      23:47:20,640 INFO [STDOUT] request: 1
      23:47:20,640 INFO [STDOUT] session: null

      I access the same url again:
      23:48:09,781 INFO [STDOUT] ###
      23:48:09,781 INFO [STDOUT] request: null
      23:48:09,781 INFO [STDOUT] session: 1
      23:48:09,796 INFO [STDOUT] ###
      23:48:09,796 INFO [STDOUT] request: 1
      23:48:09,796 INFO [STDOUT] session: 1


      Notice that both sessions show the value "1" even though the session is portlet_scoped.

      Notice that this starts working correctly after I access the second portlet with: /portal/portal/default/TEST/Test2?action=2&id=2 after which both windows/portlets have their own sessions.