4 Replies Latest reply on Sep 16, 2009 8:21 AM by jkronegg

    Where does Seam store the JSF component tree state?

    johnnyren
      I like to know where Seam stores the JSF component tree state when server side state saving approach is used.

      I recently read an article about the difference between server and client side state saving.  The URL is:
      http://wiki.glassfish.java.net/Wiki.jsp?page=JavaServerFacesRI#section-JavaServerFacesRI-WhatAreTheDifferencesBetweenServerAndClientSideStateSavingAndWhatAreTheBenefitsDrawbacksOfEach

      Basically, it says that the server side state saving approach uses less bandwidth, but more memory. Client side state saving approach, on the other hand, uses less memory but more bandwidth.

      I like to find out exactly how much memory Seam uses to store the JSF component tree state.  So  I modified our application to use sessionmon(http://code.google.com/p/sessionmon/) to monitor the http session size. 

      I am surprised that the http session size stays same no matter which state saving approach I use.  It is always 3254 bytes.

      JSF tree state is not stored in the http session. Where is it stored?  Why it is not stored in the http session?

      I use Seam 2.1 on Glassfish 2.1.

      thanks

      Johnny
        • 1. Re: Where does Seam store the JSF component tree state?
          gus888

          Any expert can give a help on this issue? I also want to know where PAGE scoped components are saved. Do PAGE scoped components consume the same memory as SESSION scoped components? Thanks a lot in advance.

          • 2. Re: Where does Seam store the JSF component tree state?
            johnnyren

            Page scoped components are saved in the JSF component tree. Session scoped components are saved in http session.  The question is that where JSF componenet tree saved in memory?  How much memory is used?

            • 3. Re: Where does Seam store the JSF component tree state?
              johnnyren
              Someone told me that it is saved in the session under the key 'com.sun.faces.logicalViewMap'. But I can’t find this key from the session object.
              There are seven key objects in the session. They are:

              org.jboss.seam.security.credentials
              org.jboss.seam.web.session
              org.jboss.seam.core.conversationEntries
              org.jboss.seam.international.localeSelector
              org.jboss.seam.security.rememberMe
              javax.faces.request.charset
              org.jboss.seam.security.identity


              Here is my code to print the objects in the session:
              FacesContext facesContext = FacesContext.getCurrentInstance();
              ExternalContext externalContext = facesContext.getExternalContext();
              HttpServletRequest request = (HttpServletRequest)externalContext.getRequest();
              HttpSession session=request.getSession();
              Enumeration e=session.getAttributeNames();
              while ( e.hasMoreElements() ) {
              System.out.println(e.nextElement());
              }

              What is going on?
              • 4. Re: Where does Seam store the JSF component tree state?
                jkronegg

                For Sun JSF RI, the 'logicalViewMap' is managed by the StateManagerImpl class.