[portal-commits] JBoss Portal SVN: r9166 - in branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl: model and 1 other directory.

portal-commits at lists.jboss.org portal-commits at lists.jboss.org
Wed Nov 28 09:06:20 EST 2007


Author: julien at jboss.com
Date: 2007-11-28 09:06:19 -0500 (Wed, 28 Nov 2007)
New Revision: 9166

Modified:
   branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/PresentationContextImpl.java
   branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
Log:
- in the presentation context, only store the nav state context and content state context in the session

Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/PresentationContextImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/PresentationContextImpl.java	2007-11-28 14:00:49 UTC (rev 9165)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/PresentationContextImpl.java	2007-11-28 14:06:19 UTC (rev 9166)
@@ -28,6 +28,8 @@
 import org.jboss.portal.presentation.impl.model.state.navigational.NavigationalStateContextImpl;
 import org.jboss.portal.presentation.model.UIContext;
 import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.state.content.ContentStateContext;
+import org.jboss.portal.presentation.model.state.navigational.NavigationalStateContext;
 import org.jboss.portal.presentation.protocol.LinkActivation;
 import org.jboss.portal.presentation.protocol.ServerAction;
 import org.jboss.portal.presentation.protocol.UIObjectAction;
@@ -45,7 +47,7 @@
 
 /**
  * @author <a href="mailto:sshah at redhat.com">Sohil Shah</a>
- *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  */
 public class PresentationContextImpl implements PresentationContext
 {
@@ -55,36 +57,44 @@
    
    /** . */
    private PresentationServer presentationServer = null;
+
+   /** . */
+   private UIContextImpl root;
    
-   /**
-    * 
-    * @param invocation
-    */
    public PresentationContextImpl(PresentationServer presentationServer, ServerInvocation invocation)
    {
       this.invocation = invocation;
       this.presentationServer = presentationServer;
    }
       
-   /**
-    * 
-    * @return
-    */
    public UIContext getUIContext()
-   {      
-      HttpSession session = this.invocation.getServerContext().getClientRequest().getSession();
+   {
+      if (root == null)
+      {
+         HttpSession session = this.invocation.getServerContext().getClientRequest().getSession();
 
+         //
+         NavigationalStateContext nsc = (NavigationalStateContext)session.getAttribute("nsc");
+         if (nsc == null)
+         {
+            nsc = new NavigationalStateContextImpl();
+            session.setAttribute("nsc", nsc);
+         }
 
-      UIContext uiContext = (UIContext)session.getAttribute("uicontext");
+         //
+         ContentStateContext csc = (ContentStateContext)session.getAttribute("csc");
+         if (csc == null)
+         {
+            csc = new ContentStateContextImpl();
+            session.setAttribute("csc", csc);
+         }
 
+         //
+         root = new UIContextImpl(presentationServer.getStructuralStateManager(), nsc, csc);
+      }
 
-      if(uiContext == null)
-      {
-         uiContext = new UIContextImpl(this.presentationServer.getStructuralStateManager(), new NavigationalStateContextImpl(), new ContentStateContextImpl());
-         session.setAttribute("uicontext", uiContext);
-      }
-      
-      return uiContext;
+      //
+      return root;
    }
    
    /**

Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java	2007-11-28 14:00:49 UTC (rev 9165)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java	2007-11-28 14:06:19 UTC (rev 9166)
@@ -34,6 +34,7 @@
 
 /**
  * @author <a href="mailto:sshah at redhat.com">Sohil Shah</a>
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  *
  */
 public abstract class UIObjectImpl implements UIObject, Serializable




More information about the portal-commits mailing list