Author: ate
Date: Thu Mar 19 11:16:55 2009
New Revision: 755924

URL: http://svn.apache.org/viewvc?rev=755924&view=rev
Log:
JS2-871: Upgrade Pluto container
See: http://issues.apache.org/jira/browse/JS2-871
- aligning with latest Pluto trunk changes to the PortletRequestContext 
interface
- moving PortletWindowRequestContext access as *non static* ThreadLocal in 
JetspeedRequestContext
- moving the now plain PortletWindowRequestContext interface (no static 
accessor anymore) to jetspeed-api
- start of using the new PortletWindowRequestContext for portlet invocation in 
JetspeedContainerServlet
- TODO: JetspeedPortletInvoker realignment to the PortletWindowRequestContext 
usage

Added:
    
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/PortletWindowRequestContextImpl.java
   (with props)
    
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/PortletWindowRequestContext.java
   (contents, props changed)
      - copied, changed from r755814, 
portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/container/PortletWindowRequestContext.java
Removed:
    
portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/container/PortletWindowRequestContext.java
Modified:
    
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/impl/PortletRequestContextImpl.java
    
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/
   (props changed)
    
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/JetspeedRequestContext.java
    
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/mockobjects/request/MockRequestContext.java
    
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestContext.java
    
portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/container/JetspeedContainerServlet.java

Modified: 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/impl/PortletRequestContextImpl.java
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/impl/PortletRequestContextImpl.java?rev=755924&r1=755923&r2=755924&view=diff
==============================================================================
--- 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/impl/PortletRequestContextImpl.java
 (original)
+++ 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/impl/PortletRequestContextImpl.java
 Thu Mar 19 11:16:55 2009
@@ -30,7 +30,7 @@
 import java.util.Map;
 import java.util.NoSuchElementException;
 
-import javax.portlet.PortletContext;
+import javax.portlet.PortletConfig;
 import javax.servlet.ServletContext;
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
@@ -63,7 +63,7 @@
     private HttpServletRequest servletRequest;
     private HttpServletResponse servletResponse;
     private PortletWindow window;
-    private PortletContext portletContext;
+    private PortletConfig portletConfig;
     private ServletContext servletContext;
     private Cookie cookies[];
     private JetspeedRequestContext requestContext;
@@ -256,9 +256,9 @@
         return cookies.length > 0 ? cookies.clone() : null;
     }
 
-    public PortletContext getPortletContext()
+    public PortletConfig getPortletConfig()
     {
-        return portletContext;
+        return portletConfig;
     }
 
     public ServletContext getServletContext()
@@ -297,9 +297,9 @@
         return preferedLocale != null ? preferedLocale : 
containerRequest.getLocale();
     }
 
-    public void init(PortletContext portletContext, ServletContext 
servletContext, HttpServletRequest servletRequest, HttpServletResponse 
servletResponse)
+    public void init(PortletConfig portletConfig, ServletContext 
servletContext, HttpServletRequest servletRequest, HttpServletResponse 
servletResponse)
     {
-        this.portletContext = portletContext;
+        this.portletConfig = portletConfig;
         this.servletContext = servletContext;
         this.servletRequest = servletRequest;
         this.servletResponse = servletResponse;

Propchange: 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Mar 19 11:16:55 2009
@@ -1,2 +1,2 @@
-target
+target
 surefire*.properties

Added: 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/PortletWindowRequestContextImpl.java
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/PortletWindowRequestContextImpl.java?rev=755924&view=auto
==============================================================================
--- 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/PortletWindowRequestContextImpl.java
 (added)
+++ 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/PortletWindowRequestContextImpl.java
 Thu Mar 19 11:16:55 2009
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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
+ *
+ *      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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jetspeed.container.invoker;
+
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+
+import org.apache.jetspeed.container.PortletWindow;
+import org.apache.jetspeed.container.PortletWindowRequestContext;
+import org.apache.jetspeed.factory.PortletInstance;
+import org.apache.pluto.container.PortletRequestContext;
+import org.apache.pluto.container.PortletResponseContext;
+
+/**
+ * @version $Id$
+ *
+ */
+public class PortletWindowRequestContextImpl implements 
PortletWindowRequestContext
+{
+    private final Action action;
+    private final PortletWindow portletWindow;
+    private final PortletRequest portletRequest;
+    private final PortletResponseContext portletResponseContext;
+    private final PortletRequestContext portletRequestContext;
+    private final PortletResponse portletResponse;
+    private final PortletInstance portletInstance;
+
+    public PortletWindowRequestContextImpl(Action action, PortletWindow 
portletWindow, PortletRequest portletRequest,
+                                           PortletResponseContext 
portletResponseContext,
+                                           PortletRequestContext 
portletRequestContext,
+                                           PortletResponse portletResponse, 
PortletInstance portletInstance)
+    {
+        this.action = action;
+        this.portletWindow = portletWindow;
+        this.portletRequest = portletRequest;
+        this.portletResponseContext = portletResponseContext;
+        this.portletRequestContext = portletRequestContext;
+        this.portletResponse = portletResponse;
+        this.portletInstance = portletInstance;
+    }
+
+    public Action getAction()
+    {
+        return action;
+    }
+
+    public PortletWindow getPortletWindow()
+    {
+        return portletWindow;
+    }
+
+    public PortletRequest getPortletRequest()
+    {
+        return portletRequest;
+    }
+
+    public PortletResponse getPortletResponse()
+    {
+        return portletResponse;
+    }
+
+    public PortletResponseContext getPortletResponseContext()
+    {
+        return portletResponseContext;
+    }
+
+    public PortletRequestContext getPortletRequestContext()
+    {
+        return portletRequestContext;
+    }
+
+    public PortletInstance getPortletInstance()
+    {
+        return portletInstance;
+    }
+}

Propchange: 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/PortletWindowRequestContextImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/PortletWindowRequestContextImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/PortletWindowRequestContextImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/JetspeedRequestContext.java
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/JetspeedRequestContext.java?rev=755924&r1=755923&r2=755924&view=diff
==============================================================================
--- 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/JetspeedRequestContext.java
 (original)
+++ 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/JetspeedRequestContext.java
 Thu Mar 19 11:16:55 2009
@@ -36,6 +36,7 @@
 import org.apache.jetspeed.capabilities.CapabilityMap;
 import org.apache.jetspeed.container.PortletWindow;
 import org.apache.jetspeed.container.PortletWindowID;
+import org.apache.jetspeed.container.PortletWindowRequestContext;
 import org.apache.jetspeed.container.url.PortalURL;
 import org.apache.jetspeed.engine.servlet.ServletRequestFactory;
 import org.apache.jetspeed.engine.servlet.ServletResponseFactory;
@@ -52,7 +53,6 @@
 import org.apache.jetspeed.security.User;
 import org.apache.jetspeed.util.JetspeedLocale;
 import org.apache.jetspeed.om.portlet.PortletDefinition;
-import org.apache.jetspeed.om.portlet.impl.LanguageImpl;
 
 /**
  * Jetspeed Request Context is associated with each portal request. The request
@@ -66,6 +66,9 @@
 public class JetspeedRequestContext implements RequestContext
 {
     private static final String ACTION_ERROR_ATTR = 
"org.apache.jetspeed.action.error:";
+    
+    private final ThreadLocal<PortletWindowRequestContext> pwrc = new 
ThreadLocal<PortletWindowRequestContext>();
+    
     private RequestContextComponent rcc;
     private HttpServletRequest request;
     private HttpServletResponse response;
@@ -304,6 +307,23 @@
         this.encoding = enc;
     }
 
+    public PortletWindowRequestContext getCurrentPortletWindowRequestContext()
+    {
+        return pwrc.get();
+    }
+    
+    public void 
setCurrentPortletWindowRequestContext(PortletWindowRequestContext value)
+    {
+        if (value == null)
+        {
+            pwrc.remove();
+        }
+        else
+        {
+            pwrc.set(value);
+        }
+    }
+
     /**
      * <p>
      * getRequestForWindow

Copied: 
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/PortletWindowRequestContext.java
 (from r755814, 
portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/container/PortletWindowRequestContext.java)
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/PortletWindowRequestContext.java?p2=portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/PortletWindowRequestContext.java&p1=portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/container/PortletWindowRequestContext.java&r1=755814&r2=755924&rev=755924&view=diff
==============================================================================
--- 
portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/container/PortletWindowRequestContext.java
 (original)
+++ 
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/PortletWindowRequestContext.java
 Thu Mar 19 11:16:55 2009
@@ -30,27 +30,6 @@
  */
 public interface PortletWindowRequestContext
 {
-    final class Current
-    {
-        private static final ThreadLocal<PortletWindowRequestContext> current 
= new ThreadLocal<PortletWindowRequestContext>();
-        
-        public static PortletWindowRequestContext 
create(PortletWindowRequestContext context)
-        {
-            current.set(context);
-            return context;
-        }
-        public static PortletWindowRequestContext get()
-        {
-            return current.get();
-        }
-        public static PortletWindowRequestContext remove()
-        {
-            PortletWindowRequestContext pwrc = current.get();
-            current.remove();
-            return pwrc;
-        }
-    }
-    
     enum Action { NOOP, LOAD, ACTION, EVENT, RESOURCE, RENDER };
     
     Action getAction();

Propchange: 
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/PortletWindowRequestContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/PortletWindowRequestContext.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: 
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/PortletWindowRequestContext.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: 
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/mockobjects/request/MockRequestContext.java
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/mockobjects/request/MockRequestContext.java?rev=755924&r1=755923&r2=755924&view=diff
==============================================================================
--- 
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/mockobjects/request/MockRequestContext.java
 (original)
+++ 
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/mockobjects/request/MockRequestContext.java
 Thu Mar 19 11:16:55 2009
@@ -38,6 +38,7 @@
 import org.apache.jetspeed.request.RequestContext;
 import org.apache.jetspeed.om.portlet.PortletDefinition;
 import org.apache.jetspeed.container.PortletWindow;
+import org.apache.jetspeed.container.PortletWindowRequestContext;
 
 
 
@@ -565,4 +566,12 @@
     {
         this.objects = objects;
     }
+    /* (non-Javadoc)
+     * @see 
org.apache.jetspeed.request.RequestContext#getCurrentPortletWindowRequestContext()
+     */
+    public PortletWindowRequestContext getCurrentPortletWindowRequestContext()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
 }

Modified: 
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestContext.java
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestContext.java?rev=755924&r1=755923&r2=755924&view=diff
==============================================================================
--- 
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestContext.java
 (original)
+++ 
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/request/RequestContext.java
 Thu Mar 19 11:16:55 2009
@@ -35,6 +35,7 @@
 import org.apache.jetspeed.om.portlet.Language;
 import org.apache.jetspeed.om.portlet.PortletDefinition;
 import org.apache.jetspeed.container.PortletWindow;
+import org.apache.jetspeed.container.PortletWindowRequestContext;
 
 /**
  * Portal Request Context is associated with each request
@@ -219,6 +220,9 @@
      */
     public void setCharacterEncoding(String enc);
 
+
+    public PortletWindowRequestContext getCurrentPortletWindowRequestContext();
+    
     /**
      *
      * <p>

Modified: 
portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/container/JetspeedContainerServlet.java
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/container/JetspeedContainerServlet.java?rev=755924&r1=755923&r2=755924&view=diff
==============================================================================
--- 
portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/container/JetspeedContainerServlet.java
 (original)
+++ 
portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/container/JetspeedContainerServlet.java
 Thu Mar 19 11:16:55 2009
@@ -29,9 +29,6 @@
 import javax.portlet.EventPortlet;
 import javax.portlet.EventRequest;
 import javax.portlet.EventResponse;
-import javax.portlet.PortletConfig;
-import javax.portlet.PortletRequest;
-import javax.portlet.PortletResponse;
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
 import javax.portlet.ResourceRequest;
@@ -46,17 +43,13 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.jetspeed.Jetspeed;
 import org.apache.jetspeed.container.session.PortalSessionsManager;
-import org.apache.jetspeed.factory.PortletInstance;
 import org.apache.jetspeed.request.RequestContext;
 import org.apache.jetspeed.services.JetspeedPortletServices;
 import org.apache.jetspeed.services.PortletServices;
 import org.apache.jetspeed.tools.pamanager.PortletApplicationManagement;
 import org.apache.jetspeed.util.DirectoryHelper;
-import org.apache.jetspeed.aggregator.CurrentWorkerContext;
-import org.apache.pluto.container.PortletInvokerService;
-import org.apache.pluto.container.PortletRequestContext;
-import org.apache.pluto.container.PortletResponseContext;
 
 /**
  * Jetspeed Container entry point.
@@ -226,86 +219,52 @@
      */
     public final void doGet(HttpServletRequest request, HttpServletResponse 
response) throws IOException, ServletException
     {
-        String portletName = null;
-        Integer method = ContainerConstants.METHOD_NOOP;
-        PortletInstance portlet = null;
         boolean destroyPortlet = false;
-        boolean isParallelMode = false;
         
-        PortletConfig portletConfig;
-        PortletRequest portletRequest;
-        PortletResponse portletResponse;
-        PortletRequestContext requestContext;
-        PortletResponseContext responseContext;
-        // TODO: add FilterManager support
-        //FilterManager filterManager;
+        RequestContext rc = Jetspeed.getCurrentRequestContext();
+        if (rc == null)
+        {
+            return;
+        }
+        PortletWindowRequestContext pwrc = 
rc.getCurrentPortletWindowRequestContext();
+        if (pwrc == null)
+        {
+            return;
+        }
         
+        if (PortletWindowRequestContext.Action.NOOP.equals(pwrc.getAction()))
+        {
+            return;
+        }
+                        
         try
         {
-            isParallelMode = CurrentWorkerContext.getParallelRenderingMode();
-
-            if (isParallelMode)
-            {
-                method = (Integer) 
CurrentWorkerContext.getAttribute(ContainerConstants.METHOD_ID);
-            }
-            else
-            {
-                method = (Integer) 
request.getAttribute(ContainerConstants.METHOD_ID);
-            }
-            if (method == ContainerConstants.METHOD_NOOP)
-            {
-                return;
-            }
-            
-            if (isParallelMode)
-            {
-                portletConfig = 
(PortletConfig)CurrentWorkerContext.getAttribute(ContainerConstants.PORTLET_CONFIG);
-                portletRequest = 
(PortletRequest)CurrentWorkerContext.getAttribute(ContainerConstants.PORTLET_REQUEST);
-                portletResponse = 
(PortletResponse)CurrentWorkerContext.getAttribute(ContainerConstants.PORTLET_RESPONSE);
-                requestContext = 
(PortletRequestContext)CurrentWorkerContext.getAttribute(PortletInvokerService.REQUEST_CONTEXT);
-                responseContext = 
(PortletResponseContext)CurrentWorkerContext.getAttribute(PortletInvokerService.RESPONSE_CONTEXT);
-                //filterManager = 
(FilterManager)CurrentWorkerContext.getAttribute(PortletInvokerService.FILTER_MANAGER);
-                portlet = (PortletInstance) 
CurrentWorkerContext.getAttribute(ContainerConstants.PORTLET);
-                portletName = (String) 
CurrentWorkerContext.getAttribute(ContainerConstants.PORTLET_NAME);
-            }
-            else
-            {
-                portletConfig = 
(PortletConfig)request.getAttribute(ContainerConstants.PORTLET_CONFIG);
-                portletRequest = 
(PortletRequest)request.getAttribute(ContainerConstants.PORTLET_REQUEST);
-                portletResponse = 
(PortletResponse)request.getAttribute(ContainerConstants.PORTLET_RESPONSE);
-                requestContext = 
(PortletRequestContext)request.getAttribute(PortletInvokerService.REQUEST_CONTEXT);
-                responseContext = 
(PortletResponseContext)request.getAttribute(PortletInvokerService.RESPONSE_CONTEXT);
-                //filterManager = 
(FilterManager)request.getAttribute(PortletInvokerService.FILTER_MANAGER);
-                portlet = 
(PortletInstance)request.getAttribute(ContainerConstants.PORTLET);
-                portletName = 
(String)request.getAttribute(ContainerConstants.PORTLET_NAME);
-            }
-
-            requestContext.init(portletConfig.getPortletContext(), 
getServletContext(), request, response);
-            responseContext.init(request, response);
+            
pwrc.getPortletRequestContext().init(pwrc.getPortletInstance().getConfig(), 
getServletContext(), request, response);
+            pwrc.getPortletResponseContext().init(request, response);
 
-            if (method == ContainerConstants.METHOD_ACTION)
+            if 
(PortletWindowRequestContext.Action.ACTION.equals(pwrc.getAction()))
             {
-                ActionRequest actionRequest = (ActionRequest)portletRequest;
-                ActionResponse actionResponse = 
(ActionResponse)portletResponse;
-                portlet.processAction(actionRequest, actionResponse);
+                ActionRequest actionRequest = 
(ActionRequest)pwrc.getPortletRequest();
+                ActionResponse actionResponse = 
(ActionResponse)pwrc.getPortletResponse();
+                pwrc.getPortletInstance().processAction(actionRequest, 
actionResponse);
             }
-            else if (method == ContainerConstants.METHOD_RENDER)
+            else if 
(PortletWindowRequestContext.Action.RENDER.equals(pwrc.getAction()))
             {
-                RenderRequest renderRequest = (RenderRequest)portletRequest;
-                RenderResponse renderResponse =  
(RenderResponse)portletResponse;
-                portlet.render(renderRequest, renderResponse);
+                RenderRequest renderRequest = 
(RenderRequest)pwrc.getPortletRequest();
+                RenderResponse renderResponse =  
(RenderResponse)pwrc.getPortletResponse();
+                pwrc.getPortletInstance().render(renderRequest, 
renderResponse);
             }
-            else if (method == ContainerConstants.METHOD_EVENT && 
portlet.getRealPortlet() instanceof EventPortlet)
+            else if 
(PortletWindowRequestContext.Action.EVENT.equals(pwrc.getAction()) && 
pwrc.getPortletInstance().getRealPortlet() instanceof EventPortlet)
             {
-                EventRequest eventRequest = (EventRequest)portletRequest;
-                EventResponse eventResponse =  (EventResponse)portletResponse;
-                
((EventPortlet)portlet.getRealPortlet()).processEvent(eventRequest, 
eventResponse);
+                EventRequest eventRequest = 
(EventRequest)pwrc.getPortletRequest();
+                EventResponse eventResponse =  
(EventResponse)pwrc.getPortletResponse();
+                
((EventPortlet)pwrc.getPortletInstance().getRealPortlet()).processEvent(eventRequest,
 eventResponse);
             }
-            else if (method == ContainerConstants.METHOD_RESOURCE && 
portlet.getRealPortlet() instanceof ResourceServingPortlet)
+            else if 
(PortletWindowRequestContext.Action.RESOURCE.equals(pwrc.getAction()) && 
pwrc.getPortletInstance().getRealPortlet() instanceof ResourceServingPortlet)
             {
-                ResourceRequest resourceRequest = 
(ResourceRequest)portletRequest;
-                ResourceResponse resourceResponse = 
(ResourceResponse)portletResponse;
-                
((ResourceServingPortlet)portlet.getRealPortlet()).serveResource(resourceRequest,
 resourceResponse);
+                ResourceRequest resourceRequest = 
(ResourceRequest)pwrc.getPortletRequest();
+                ResourceResponse resourceResponse = 
(ResourceResponse)pwrc.getPortletResponse();
+                
((ResourceServingPortlet)pwrc.getPortletInstance().getRealPortlet()).serveResource(resourceRequest,
 resourceResponse);
             }
 
             // if we get this far we are home free
@@ -319,10 +278,10 @@
                 destroyPortlet = true;
             }
             
-            if (method != ContainerConstants.METHOD_ACTION)
+            if 
(PortletWindowRequestContext.Action.ACTION.equals(pwrc.getAction()))
             {
                 ServletContext context = getServletContext();
-                context.log(JCS + "Error rendering portlet \"" + portletName + 
"\": " + t.toString(), t);
+                context.log(JCS + "Error rendering portlet \"" + 
pwrc.getPortletWindow().getPortletEntity().getPortletUniqueName() + "\": " + 
t.toString(), t);
                 try
                 {
                     String errorTemplate = 
getInitParameter("portal.error.page");
@@ -341,12 +300,12 @@
                     }
                     else
                     {
-                        displayPortletNotAvailableMessage(t, response, 
portletName);
+                        displayPortletNotAvailableMessage(t, response, 
pwrc.getPortletWindow().getPortletEntity().getPortletUniqueName());
                     }
                 }
                 catch (Throwable e)
                 {
-                    displayPortletNotAvailableMessage(t, response, 
portletName);
+                    displayPortletNotAvailableMessage(t, response, 
pwrc.getPortletWindow().getPortletEntity().getPortletUniqueName());
                 }
                 finally
                 {
@@ -375,12 +334,12 @@
         }
         finally
         {
-            if ( destroyPortlet && portlet != null)
+            if ( destroyPortlet)
             {
                 // portlet threw UnavailableException: take it out of service
                 try
                 {
-                    portlet.destroy();
+                    pwrc.getPortletInstance().destroy();
                 }
                 catch (Exception e)
                 {
@@ -389,7 +348,6 @@
             }
             if (psm != null)
             {
-                RequestContext rc = 
(RequestContext)request.getAttribute(RequestContext.REQUEST_PORTALENV);
                 
psm.checkMonitorSession(contextName,rc.getRequest().getSession(),request.getSession(false));
             }
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to