You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by cz...@apache.org on 2009/02/25 14:07:22 UTC

svn commit: r747768 - in /portals/pluto/trunk: pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/ pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/ pluto-portal-driver/src/main/java/org/apache/pluto/driver/...

Author: cziegeler
Date: Wed Feb 25 13:07:22 2009
New Revision: 747768

URL: http://svn.apache.org/viewvc?rev=747768&view=rev
Log:
Use static method to retrieve portal request context instead of exposing the attribute and the mechanism to potential clients.

Modified:
    portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletURLProviderImpl.java
    portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/PortalRequestContext.java
    portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/ResourceURLProviderImpl.java
    portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/tags/PortletPortalURLTag.java

Modified: portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletURLProviderImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletURLProviderImpl.java?rev=747768&r1=747767&r2=747768&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletURLProviderImpl.java (original)
+++ portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletURLProviderImpl.java Wed Feb 25 13:07:22 2009
@@ -46,8 +46,7 @@
 
     public PortletURLProviderImpl(HttpServletRequest request,
                                   PortletWindow portletWindow) {
-        PortalRequestContext ctx = (PortalRequestContext)
-            request.getAttribute(PortalRequestContext.REQUEST_KEY);
+        PortalRequestContext ctx = PortalRequestContext.getContext(request);
         url = ctx.createPortalURL();
 
         this.window = portletWindow.getId().getStringId();
@@ -140,8 +139,7 @@
     }
 
 	public void savePortalURL(HttpServletRequest request) {
-		PortalRequestContext ctx = (PortalRequestContext)
-			request.getAttribute(PortalRequestContext.REQUEST_KEY);
+        PortalRequestContext ctx = PortalRequestContext.getContext(request);
 		ctx.setPortalURL(url);
 	}
 

Modified: portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/PortalRequestContext.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/PortalRequestContext.java?rev=747768&r1=747767&r2=747768&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/PortalRequestContext.java (original)
+++ portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/PortalRequestContext.java Wed Feb 25 13:07:22 2009
@@ -39,13 +39,13 @@
 public class PortalRequestContext {
 
     /** Internal Logger. */
-    private static final Log LOG = LogFactory.getLog(PortalRequestContext.class);    
+    private static final Log LOG = LogFactory.getLog(PortalRequestContext.class);
 
     /**
      * The attribute key to bind the portal environment instance to servlet
      * request.
      */
-    public final static String REQUEST_KEY =
+    private final static String REQUEST_KEY =
             PortalRequestContext.class.getName();
 
     /** The servletContext of execution. **/
@@ -129,18 +129,14 @@
     public PortalURL createPortalURL() {
         return (PortalURL)getRequestedPortalURL().clone();
     }
-    
+
     public void setPortalURL(PortalURL portalURL){
     	requestedPortalURL = portalURL;
     }
 
-	public static String getREQUEST_KEY() {
-		return REQUEST_KEY;
-	}
-
 	public ServletContext getServletContext() {
 		return servletContext;
 	}
-    
-    
+
+
 }

Modified: portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/ResourceURLProviderImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/ResourceURLProviderImpl.java?rev=747768&r1=747767&r2=747768&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/ResourceURLProviderImpl.java (original)
+++ portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/ResourceURLProviderImpl.java Wed Feb 25 13:07:22 2009
@@ -5,13 +5,13 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,8 +40,7 @@
 
     public ResourceURLProviderImpl(HttpServletRequest req,
                                    PortletWindow portletWindow) {
-        PortalRequestContext ctx = (PortalRequestContext)
-            req.getAttribute(PortalRequestContext.REQUEST_KEY);
+        PortalRequestContext ctx = PortalRequestContext.getContext(req);
 
         this.base = ctx.createPortalURL().getServerURI();
         if (LOG.isDebugEnabled()) {

Modified: portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/tags/PortletPortalURLTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/tags/PortletPortalURLTag.java?rev=747768&r1=747767&r2=747768&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/tags/PortletPortalURLTag.java (original)
+++ portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/tags/PortletPortalURLTag.java Wed Feb 25 13:07:22 2009
@@ -90,8 +90,7 @@
         HttpServletResponse response = (HttpServletResponse)
                 pageContext.getResponse();
 
-        PortalRequestContext ctx = (PortalRequestContext)
-            request.getAttribute(PortalRequestContext.REQUEST_KEY);
+        PortalRequestContext ctx = PortalRequestContext.getContext(request);
 
         PortalURL portalUrl =  ctx.createPortalURL();