[gatein-commits] gatein SVN: r4499 - in components/pc/trunk: portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Oct 5 04:57:34 EDT 2010


Author: chris.laprun at jboss.com
Date: 2010-10-05 04:57:33 -0400 (Tue, 05 Oct 2010)
New Revision: 4499

Modified:
   components/pc/trunk/api/src/main/java/org/gatein/pc/api/spi/WindowContext.java
   components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api/PortletResponseImpl.java
   components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/spi/AbstractWindowContext.java
Log:
- GTNPC-32: Separated namespace from id in WindowContext.

Modified: components/pc/trunk/api/src/main/java/org/gatein/pc/api/spi/WindowContext.java
===================================================================
--- components/pc/trunk/api/src/main/java/org/gatein/pc/api/spi/WindowContext.java	2010-10-05 08:55:53 UTC (rev 4498)
+++ components/pc/trunk/api/src/main/java/org/gatein/pc/api/spi/WindowContext.java	2010-10-05 08:57:33 UTC (rev 4499)
@@ -34,4 +34,12 @@
     * @return the window id
     */
    String getId();
+
+   /**
+    * Return a String that can be used for the Portlet prefixing of tokens that need to be unique within the markup of
+    * the aggregated page (e.g. JavaScript variables, HTML id attributes, etc.)
+    *
+    * @return a String that can be used as namespace in aggregated markup
+    */
+   String getNamespace();
 }

Modified: components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api/PortletResponseImpl.java
===================================================================
--- components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api/PortletResponseImpl.java	2010-10-05 08:55:53 UTC (rev 4498)
+++ components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api/PortletResponseImpl.java	2010-10-05 08:57:33 UTC (rev 4499)
@@ -25,10 +25,9 @@
 import org.gatein.pc.api.invocation.PortletInvocation;
 import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
 import org.gatein.pc.api.invocation.response.ResponseProperties;
-import org.gatein.pc.portlet.impl.jsr168.PortletUtils;
-import org.w3c.dom.Element;
 import org.w3c.dom.DOMException;
 import org.w3c.dom.Document;
+import org.w3c.dom.Element;
 
 import javax.portlet.PortletResponse;
 import javax.servlet.http.Cookie;
@@ -49,9 +48,6 @@
    /** . */
    protected final PortletRequestImpl preq;
 
-   /** The namespace. */
-   private String namespace;
-
    /** . */
    private Document doc;
 
@@ -138,12 +134,7 @@
 
    public String getNamespace()
    {
-      if (namespace == null)
-      {
-         String windowId = invocation.getWindowContext().getId();
-         namespace = PortletUtils.generateNamespaceFrom(windowId);
-      }
-      return namespace;
+      return invocation.getWindowContext().getNamespace();
    }
 
    public final HttpServletResponseWrapper getRealResponse()

Modified: components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/spi/AbstractWindowContext.java
===================================================================
--- components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/spi/AbstractWindowContext.java	2010-10-05 08:55:53 UTC (rev 4498)
+++ components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/spi/AbstractWindowContext.java	2010-10-05 08:57:33 UTC (rev 4499)
@@ -23,6 +23,7 @@
 package org.gatein.pc.portlet.impl.spi;
 
 import org.gatein.pc.api.spi.WindowContext;
+import org.gatein.pc.portlet.impl.jsr168.PortletUtils;
 
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -33,6 +34,7 @@
 
    /** . */
    private final String id;
+   private final String namespace;
 
    public AbstractWindowContext(String id)
    {
@@ -41,10 +43,17 @@
          throw new IllegalArgumentException("No window id provided");
       }
       this.id = id;
+
+      namespace = PortletUtils.generateNamespaceFrom(id);
    }
 
    public String getId()
    {
       return id;
    }
+
+   public String getNamespace()
+   {
+      return namespace;
+   }
 }



More information about the gatein-commits mailing list