portals-pluto-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r713690 - in /portals/pluto/trunk: pluto-container-api/src/main/java/org/apache/pluto/internal/ pluto-container/src/main/java/org/apache/pluto/internal/impl/ pluto-container/src/test/java/org/apache/pluto/internal/impl/
Date Thu, 13 Nov 2008 09:44:31 GMT
Author: ate
Date: Thu Nov 13 01:44:31 2008
New Revision: 713690

URL: http://svn.apache.org/viewvc?rev=713690&view=rev
Log:
PLUTO-523: Further abstractions of the Pluto SPI to support embedding in and extending by
other portals
See: https://issues.apache.org/jira/browse/PLUTO-523?focusedCommentId=12647241#action_12647241

Abstracting the PortletRequestImpl.getContextPath() to delegate to new method InternalPortletContext.getContextPath().
This allows other portals like Jetspeed to easily override this without having to wrap all
the PortletRequest class implementations.
Use case for Jetspeed is supporting "local" portlet applications which run within a different
context (the portal in this case).

Modified:
    portals/pluto/trunk/pluto-container-api/src/main/java/org/apache/pluto/internal/InternalPortletConfig.java
    portals/pluto/trunk/pluto-container-api/src/main/java/org/apache/pluto/internal/InternalPortletContext.java
    portals/pluto/trunk/pluto-container-api/src/main/java/org/apache/pluto/internal/InternalPortletRequest.java
    portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletContextImpl.java
    portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestImpl.java
    portals/pluto/trunk/pluto-container/src/test/java/org/apache/pluto/internal/impl/PortletRequestImplTest.java

Modified: portals/pluto/trunk/pluto-container-api/src/main/java/org/apache/pluto/internal/InternalPortletConfig.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container-api/src/main/java/org/apache/pluto/internal/InternalPortletConfig.java?rev=713690&r1=713689&r2=713690&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container-api/src/main/java/org/apache/pluto/internal/InternalPortletConfig.java
(original)
+++ portals/pluto/trunk/pluto-container-api/src/main/java/org/apache/pluto/internal/InternalPortletConfig.java
Thu Nov 13 01:44:31 2008
@@ -17,7 +17,6 @@
 package org.apache.pluto.internal;
 
 import javax.portlet.PortletConfig;
-import javax.servlet.ServletConfig;
 
 import org.apache.pluto.om.portlet.PortletDefinition;
 

Modified: portals/pluto/trunk/pluto-container-api/src/main/java/org/apache/pluto/internal/InternalPortletContext.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container-api/src/main/java/org/apache/pluto/internal/InternalPortletContext.java?rev=713690&r1=713689&r2=713690&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container-api/src/main/java/org/apache/pluto/internal/InternalPortletContext.java
(original)
+++ portals/pluto/trunk/pluto-container-api/src/main/java/org/apache/pluto/internal/InternalPortletContext.java
Thu Nov 13 01:44:31 2008
@@ -34,6 +34,12 @@
      * @return servlet context within which we belong
      */
     public ServletContext getServletContext();
+    
+    /**
+     *
+     * @return the context path for this PortletContext
+     */
+    public String getContextPath();
 
     /**
      *

Modified: portals/pluto/trunk/pluto-container-api/src/main/java/org/apache/pluto/internal/InternalPortletRequest.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container-api/src/main/java/org/apache/pluto/internal/InternalPortletRequest.java?rev=713690&r1=713689&r2=713690&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container-api/src/main/java/org/apache/pluto/internal/InternalPortletRequest.java
(original)
+++ portals/pluto/trunk/pluto-container-api/src/main/java/org/apache/pluto/internal/InternalPortletRequest.java
Thu Nov 13 01:44:31 2008
@@ -16,7 +16,6 @@
  */
 package org.apache.pluto.internal;
 
-import javax.portlet.PortletContext;
 import javax.portlet.PortletRequest;
 import javax.servlet.http.HttpServletRequest;
 
@@ -39,7 +38,7 @@
      * @param context  the target portlet context.
      * @param request  the servlet request.
      */
-    public void init(PortletContext context, HttpServletRequest request);
+    public void init(InternalPortletContext context, HttpServletRequest request);
 
     /**
      * Recycle the request by rolling the underlying request

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletContextImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletContextImpl.java?rev=713690&r1=713689&r2=713690&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletContextImpl.java
(original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletContextImpl.java
Thu Nov 13 01:44:31 2008
@@ -102,6 +102,13 @@
         this.contextClassLoader = contextClassLoader;
     }
 
+    public String getContextPath() {
+        String path = portletApp.getName();
+        if (!path.equals("")) {
+            path = "/" + path;
+        }
+        return path;
+    }
     
     // PortletContext Impl -----------------------------------------------------
     

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestImpl.java?rev=713690&r1=713689&r2=713690&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestImpl.java
(original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestImpl.java
Thu Nov 13 01:44:31 2008
@@ -61,6 +61,7 @@
 import org.apache.pluto.PortletContainer;
 import org.apache.pluto.PortletEntity;
 import org.apache.pluto.PortletWindow;
+import org.apache.pluto.internal.InternalPortletContext;
 import org.apache.pluto.internal.InternalPortletRequest;
 import org.apache.pluto.om.portlet.PortletDefinition;
 import org.apache.pluto.om.portlet.SecurityRoleRef;
@@ -117,7 +118,7 @@
      * The PortletContext associated with this Request. This PortletContext must
      * be initialized from within the <code>PortletServlet</code>.
      */
-    private PortletContext portletContext;
+    private InternalPortletContext portletContext;
 
     /** The PortalContext within which this request is occuring. */
     private PortalContext portalContext;
@@ -377,11 +378,7 @@
     }
 
     public String getContextPath() {
-        String name = portletWindow.getPortletEntity().getPortletDefinition().getApplication().getName();
-        if (!name.equals("")) {
-            name = "/" + name;
-        }
-        return name;
+        return portletContext.getContextPath();
     }
 
     public String getRemoteUser() {
@@ -622,7 +619,7 @@
         return (HttpServletRequest) super.getRequest();
     }
     
-    public void init(PortletContext portletContext, HttpServletRequest req) {
+    public void init(InternalPortletContext portletContext, HttpServletRequest req) {
         this.portletContext = portletContext;
         setRequest(req);
         setCCPPProfile();

Modified: portals/pluto/trunk/pluto-container/src/test/java/org/apache/pluto/internal/impl/PortletRequestImplTest.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/test/java/org/apache/pluto/internal/impl/PortletRequestImplTest.java?rev=713690&r1=713689&r2=713690&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/test/java/org/apache/pluto/internal/impl/PortletRequestImplTest.java
(original)
+++ portals/pluto/trunk/pluto-container/src/test/java/org/apache/pluto/internal/impl/PortletRequestImplTest.java
Thu Nov 13 01:44:31 2008
@@ -17,7 +17,6 @@
 package org.apache.pluto.internal.impl;
 
 import javax.portlet.PortalContext;
-import javax.portlet.PortletContext;
 import javax.portlet.PortletPreferences;
 import javax.portlet.PortletSession;
 import javax.servlet.http.HttpServletRequest;
@@ -27,6 +26,7 @@
 import org.apache.pluto.PortletContainer;
 import org.apache.pluto.RequiredContainerServices;
 import org.apache.pluto.core.PortletContainerImpl;
+import org.apache.pluto.internal.InternalPortletContext;
 import org.apache.pluto.internal.InternalPortletRequest;
 import org.apache.pluto.PortletWindow;
 import org.apache.pluto.spi.CCPPProfileService;
@@ -67,7 +67,7 @@
         mockCCPPProfileService = mock( CCPPProfileService.class );
         mockOptionalServices = mock( OptionalContainerServices.class );
         mockPortalContext = mock( PortalContext.class );
-        mockPortletContext = mock( PortletContext.class );
+        mockPortletContext = mock( InternalPortletContext.class );
         mockContainer = mock( PortletContainerImpl.class,
                 new Class[] { String.class, RequiredContainerServices.class, OptionalContainerServices.class
},
                 new Object[] { "Mock Pluto Container", (RequiredContainerServices) mockServices.proxy(),
null } );
@@ -107,7 +107,7 @@
 
         // Create the render request that is under test, and initialize its state
         RenderRequestImpl request = new RenderRequestImpl( (PortletContainer)mockContainer.proxy(),
window, (HttpServletRequest)mockHttpServletRequest.proxy() );
-        request.init( (PortletContext)mockPortletContext.proxy(), ( HttpServletRequest)mockHttpServletRequest.proxy()
);
+        request.init( (InternalPortletContext)mockPortletContext.proxy(), ( HttpServletRequest)mockHttpServletRequest.proxy()
);
 
         // Mock the HttpSession, and set its expectations: it will return 0 for the last
accessed time, and 5
         // for the maximum inactive interval



Mime
View raw message