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 dd...@apache.org on 2005/11/20 03:37:11 UTC

svn commit: r345710 - in /portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core: InternalPortletRequest.java PortletServlet.java impl/PortletRequestImpl.java

Author: ddewolf
Date: Sat Nov 19 18:37:06 2005
New Revision: 345710

URL: http://svn.apache.org/viewcvs?rev=345710&view=rev
Log:
Standardizing the *late* initialization of the portlet request.  This init occurs after the crossContext dispatch and should be released after being processed

Modified:
    portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/InternalPortletRequest.java
    portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletServlet.java
    portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/impl/PortletRequestImpl.java

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/InternalPortletRequest.java
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/InternalPortletRequest.java?rev=345710&r1=345709&r2=345710&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/InternalPortletRequest.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/InternalPortletRequest.java Sat Nov 19 18:37:06 2005
@@ -27,9 +27,22 @@
 
 public interface InternalPortletRequest extends PortletRequest {
 
-    void setPortletContext(PortletContext context);
+    /**
+     * Initialize the portlet for use within the target context.
+     * This method ensures that the portlet utilizes resources
+     * from the *included* context, and not those from the
+     * intiating (portal) context.
+     * @param context
+     * @param req
+     */
+    void init(PortletContext context, HttpServletRequest req);
+
+    /**
+     * Recycle the request by rolling the underlying request
+     * back to the originating request.
+     */
+    void release();
 
-    void setServiceRequest(HttpServletRequest req);
 
     InternalPortletWindow getInternalPortletWindow();
 

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletServlet.java
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletServlet.java?rev=345710&r1=345709&r2=345710&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletServlet.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletServlet.java Sat Nov 19 18:37:06 2005
@@ -135,6 +135,8 @@
     private void dispatch(HttpServletRequest request,
                           HttpServletResponse response)
         throws ServletException, IOException {
+        InternalPortletRequest pRequest = null;
+        InternalPortletResponse pResponse = null;
         try {
             request.setAttribute(org.apache.pluto.Constants.PORTLET_CONFIG,
                                  portletConfig);
@@ -143,14 +145,13 @@
                 (Integer) request.getAttribute(
                     org.apache.pluto.Constants.METHOD_ID);
 
-            InternalPortletRequest pRequest = (InternalPortletRequest)
+            pRequest = (InternalPortletRequest)
                 request.getAttribute(Constants.PORTLET_REQUEST);
 
-            InternalPortletResponse pResponse = (InternalPortletResponse)
+            pResponse = (InternalPortletResponse)
                 request.getAttribute(Constants.PORTLET_RESPONSE);
 
-            pRequest.setPortletContext(portletContext);
-            pRequest.setServiceRequest(request);
+            pRequest.init(portletContext, request);
 
             if (method_id == org.apache.pluto.Constants.METHOD_RENDER) {
                 RenderRequestImpl renderRequest =
@@ -195,6 +196,10 @@
             throw new ServletException(e);
         } finally {
             request.removeAttribute(org.apache.pluto.Constants.PORTLET_CONFIG);
+
+            if(pRequest != null)
+                pRequest.release();
+
         }
     }
 }

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/impl/PortletRequestImpl.java
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/impl/PortletRequestImpl.java?rev=345710&r1=345709&r2=345710&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/impl/PortletRequestImpl.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/impl/PortletRequestImpl.java Sat Nov 19 18:37:06 2005
@@ -668,12 +668,16 @@
 
 // Internal Implementation Detailes
 
-    public void setPortletContext(PortletContext portletContext) {
+    public void init(PortletContext portletContext, HttpServletRequest req) {
         this.portletContext = portletContext;
+        setRequest(req);
     }
 
-    public void setServiceRequest(HttpServletRequest req) {
-        setRequest(req);
+    /**
+     * @todo Implement this properly.  Not required now
+     */
+    public void release() {
+
     }
 
     public PortletContainer getContainer() {