1 Reply Latest reply on Aug 25, 2008 3:13 PM by prabhat.jha

    how big is portal/portlet session?

    prabhat.jha

      Hello :-)

      If I add an attribute to Portlet Session as following:

      PortletSession session = request.getPortletSession(true);
      Integer data = new Integer(0);
      session.setAttribute("my_data", data);
      


      I then do serialization/deserialization to find the size of this object:
      ByteArrayOutputStream bs = new ByteArrayOutputStream();
      ObjectOutputStream os = new ObjectOutputStream(bs);
      os.writeObject(seqNumber);
      int sessionSize = bs.size();
      


      Does it mean that Http Session size is value of sessionSize in above code snippet?

      I have iterated through all the attributes in PortletSession (both app and portlet scope) and I see that there is nothing else in the session. There does not seem to be a way to get hold on HttpSession from Portlet and PortletSession is not serializable and rightly so, can I safely conclude based on above code that value of sessionSize is the value of size of HttpSession?

        • 1. Re: how big is portal/portlet session?
          prabhat.jha

          Answer is no. I modified ContentTypeInterceptor to spit out values in HttpSession since over there I have access to it and this is what I get:

          Object org.jboss.portal.session.contexts
          value is [/failover-portlet]

          Object jboss.portlet.session.FailoverTestPortletInstance
          value is org.jboss.portal.portlet.session.SubSession@1127dc0

          Object portal.principalview_id
          value is 0

          Object portal.principal/default/FailoverTestPortletPage/FailoverTestPageWindow
          value is org.jboss.portal.core.model.portal.navstate.WindowNavigationalState@17a1ad3

          So, total session size will be sum of sizes of all these.