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 ms...@apache.org on 2015/11/27 13:38:04 UTC

[23/38] portals-pluto git commit: Completed the move to dynamic servlet deployment. Now it should no longer be necessary to use the maven plugin to process the portlet web.xml files. The web.xml can be the minimum needed by the application itself, or can

Completed the move to dynamic servlet deployment. Now it should no longer be
necessary to use the maven plugin to process the portlet web.xml files. The
web.xml can be the minimum needed by the application itself, or can be not
present at all as allowed by the servlet specification 3.1. The portlet DD
is still needed, however, since the configuration through annotation code is
not yet implemented.

One point that needs to be addressed in the future is the servlet container
initializer. Portlet container bringup should probably be moved to a Spring
WebApplicationInitializer, which would probably allow a nicer module
structure.


Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/8fb2d088
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/8fb2d088
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/8fb2d088

Branch: refs/heads/V3Prototype
Commit: 8fb2d088c82e43c7a384024e16548387e54ed93b
Parents: 1535653
Author: Scott Nicklous <ms...@apache.org>
Authored: Wed Nov 18 11:31:28 2015 +0100
Committer: Scott Nicklous <ms...@apache.org>
Committed: Wed Nov 18 11:31:28 2015 +0100

----------------------------------------------------------------------
 .../pluto/container/PortletInvokerService.java  | 290 +++++------
 .../driver/PortalDriverContainerServices.java   | 106 ++--
 .../driver/PortletContainerInitializer.java     |  37 +-
 .../pluto/container/driver/PortletServlet.java  | 505 ++-----------------
 .../pluto/container/driver/PortletServlet3.java | 475 +++++++++++++++++
 .../om/portlet/impl/ConfigurationProcessor.java |   7 +-
 .../container/DefaultPortletInvokerService.java |  19 +-
 .../container/PortletDescriptorRegistry.java    |  35 +-
 pom.xml                                         |   1 +
 9 files changed, 761 insertions(+), 714 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/8fb2d088/pluto-container-api/src/main/java/org/apache/pluto/container/PortletInvokerService.java
----------------------------------------------------------------------
diff --git a/pluto-container-api/src/main/java/org/apache/pluto/container/PortletInvokerService.java b/pluto-container-api/src/main/java/org/apache/pluto/container/PortletInvokerService.java
index 56eca34..8b35a56 100644
--- a/pluto-container-api/src/main/java/org/apache/pluto/container/PortletInvokerService.java
+++ b/pluto-container-api/src/main/java/org/apache/pluto/container/PortletInvokerService.java
@@ -1,142 +1,148 @@
-/*
- * 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.pluto.container;
-
-import java.io.IOException;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.EventRequest;
-import javax.portlet.EventResponse;
-import javax.portlet.PortletException;
-import javax.portlet.PortletRequest;
-import javax.portlet.PortletResponse;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.ResourceRequest;
-import javax.portlet.ResourceResponse;
-
-
-/**
- * Service used to invoke portlets.
- */
-public interface PortletInvokerService {
-
-    /**
-     * The key used to bind the <code>PortletRequest</code> to the underlying
-     * <code>HttpServletRequest</code>.
-     */
-    String PORTLET_REQUEST = "javax.portlet.request";
-
-    /**
-     * The key used to bind the <code>PortletResponse</code> to the underlying
-     * <code>HttpServletRequest</code>.
-     */
-    String PORTLET_RESPONSE = "javax.portlet.response";
-
-    /**
-     * The key used to bind the <code>PortletConfig</code> to the underlying
-     * PortletConfig.
-     */
-    String PORTLET_CONFIG = "javax.portlet.config";
-
-    /**
-     * The request attribute key used to retrieve the <code>PortletRequestContext</code> instance
-     */
-    String REQUEST_CONTEXT = PortletRequestContext.class.getName();
-
-    /**
-     * The request attribute key used to retrieve the <code>PortletRequestContext</code> instance
-     */
-    String RESPONSE_CONTEXT = PortletResponseContext.class.getName();
-
-    /**
-     * The key used to bind the method of processing being requested by the
-     * container to the underlying <code>PortletRquest</code>.
-     */
-    String METHOD_ID = "org.apache.pluto.core.method";
-
-    /**
-     * The unique method identifier for render requests.  Render requests are
-     * requested through a call to the {@link PortletContainer#doRender(org.apache.pluto.container.PortletWindow,
-     * javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)}
-     * method.
-     */
-    Integer METHOD_RENDER = new Integer(1);
-
-    /**
-     * The unique method identifier for render requests.  Render requests are
-     * requested through a call to the {@link PortletContainer#doAction(org.apache.pluto.container.PortletWindow,
-     * javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)}
-     * method.
-     */
-    Integer METHOD_ACTION = new Integer(3);
-
-    /**
-     * The unique method identifier for load requests.  Load requests are
-     * requested through a call to the {@link PortletContainer#doLoad(org.apache.pluto.container.PortletWindow,
-     * javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)}
-     * method.
-     */
-    Integer METHOD_LOAD = new Integer(5);
-
-    /**
-     * The unique method identifier for resource Serving requests.  Resource requests are
-     * requested through a call to the {@link PortletContainer#doServeResource(PortletWindow,
-     *  javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)}
-     * method.
-     */
-    Integer METHOD_RESOURCE = new Integer(7);
-
-    /**
-     * The unique method identifier for render requests.  Render requests are
-     * requested through a call to the {@link PortletContainer#doEvent(org.apache.pluto.container.PortletWindow,
-     * javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, javax.portlet.Event)}
-     * method.
-     */
-    Integer METHOD_EVENT = new Integer(9);
-
-    /**
-     * The unique method identifier for admin requests.  Admin requests
-     * are requested through a call to the {@link PortletContainer#doAdmin(PortletWindow, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)}
-     * method.
-     */
-    Integer  METHOD_ADMIN = new Integer(11);
-
-    /**
-     * The public key, to store the FilterManager in the request.
-     */
-    String FILTER_MANAGER = "FilterManager";
-
-    void action(PortletRequestContext ctx, ActionRequest req, ActionResponse res, FilterManager filterManager)
-    throws IOException, PortletException, PortletContainerException;
-
-    void event(PortletRequestContext ctx, EventRequest request, EventResponse response, FilterManager filterManager)
-    throws IOException, PortletException, PortletContainerException;
-
-    void render(PortletRequestContext ctx, RenderRequest req, RenderResponse res, FilterManager filterManager)
-    throws IOException, PortletException, PortletContainerException;
-
-    void serveResource(PortletRequestContext ctx, ResourceRequest req, ResourceResponse res, FilterManager filterManager)
-    throws IOException, PortletException, PortletContainerException;
-
-    void load(PortletRequestContext ctx, PortletRequest req, PortletResponse res)
-    throws IOException, PortletException, PortletContainerException;
-
-    void admin(PortletRequestContext ctx, PortletRequest req, PortletResponse res)
-    throws IOException, PortletException, PortletContainerException;
-}
+/*
+ * 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.pluto.container;
+
+import java.io.IOException;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+
+
+/**
+ * Service used to invoke portlets.
+ */
+public interface PortletInvokerService {
+
+
+   /** 
+    * URI prefix of the portlet invoker servlet for generating the servlet mapping.
+    */
+   static final String URIPREFIX = "/PlutoInvoker3/";
+         
+    /**
+     * The key used to bind the <code>PortletRequest</code> to the underlying
+     * <code>HttpServletRequest</code>.
+     */
+    String PORTLET_REQUEST = "javax.portlet.request";
+
+    /**
+     * The key used to bind the <code>PortletResponse</code> to the underlying
+     * <code>HttpServletRequest</code>.
+     */
+    String PORTLET_RESPONSE = "javax.portlet.response";
+
+    /**
+     * The key used to bind the <code>PortletConfig</code> to the underlying
+     * PortletConfig.
+     */
+    String PORTLET_CONFIG = "javax.portlet.config";
+
+    /**
+     * The request attribute key used to retrieve the <code>PortletRequestContext</code> instance
+     */
+    String REQUEST_CONTEXT = PortletRequestContext.class.getName();
+
+    /**
+     * The request attribute key used to retrieve the <code>PortletRequestContext</code> instance
+     */
+    String RESPONSE_CONTEXT = PortletResponseContext.class.getName();
+
+    /**
+     * The key used to bind the method of processing being requested by the
+     * container to the underlying <code>PortletRquest</code>.
+     */
+    String METHOD_ID = "org.apache.pluto.core.method";
+
+    /**
+     * The unique method identifier for render requests.  Render requests are
+     * requested through a call to the {@link PortletContainer#doRender(org.apache.pluto.container.PortletWindow,
+     * javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)}
+     * method.
+     */
+    Integer METHOD_RENDER = new Integer(1);
+
+    /**
+     * The unique method identifier for render requests.  Render requests are
+     * requested through a call to the {@link PortletContainer#doAction(org.apache.pluto.container.PortletWindow,
+     * javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)}
+     * method.
+     */
+    Integer METHOD_ACTION = new Integer(3);
+
+    /**
+     * The unique method identifier for load requests.  Load requests are
+     * requested through a call to the {@link PortletContainer#doLoad(org.apache.pluto.container.PortletWindow,
+     * javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)}
+     * method.
+     */
+    Integer METHOD_LOAD = new Integer(5);
+
+    /**
+     * The unique method identifier for resource Serving requests.  Resource requests are
+     * requested through a call to the {@link PortletContainer#doServeResource(PortletWindow,
+     *  javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)}
+     * method.
+     */
+    Integer METHOD_RESOURCE = new Integer(7);
+
+    /**
+     * The unique method identifier for render requests.  Render requests are
+     * requested through a call to the {@link PortletContainer#doEvent(org.apache.pluto.container.PortletWindow,
+     * javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, javax.portlet.Event)}
+     * method.
+     */
+    Integer METHOD_EVENT = new Integer(9);
+
+    /**
+     * The unique method identifier for admin requests.  Admin requests
+     * are requested through a call to the {@link PortletContainer#doAdmin(PortletWindow, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)}
+     * method.
+     */
+    Integer  METHOD_ADMIN = new Integer(11);
+
+    /**
+     * The public key, to store the FilterManager in the request.
+     */
+    String FILTER_MANAGER = "FilterManager";
+
+    void action(PortletRequestContext ctx, ActionRequest req, ActionResponse res, FilterManager filterManager)
+    throws IOException, PortletException, PortletContainerException;
+
+    void event(PortletRequestContext ctx, EventRequest request, EventResponse response, FilterManager filterManager)
+    throws IOException, PortletException, PortletContainerException;
+
+    void render(PortletRequestContext ctx, RenderRequest req, RenderResponse res, FilterManager filterManager)
+    throws IOException, PortletException, PortletContainerException;
+
+    void serveResource(PortletRequestContext ctx, ResourceRequest req, ResourceResponse res, FilterManager filterManager)
+    throws IOException, PortletException, PortletContainerException;
+
+    void load(PortletRequestContext ctx, PortletRequest req, PortletResponse res)
+    throws IOException, PortletException, PortletContainerException;
+
+    void admin(PortletRequestContext ctx, PortletRequest req, PortletResponse res)
+    throws IOException, PortletException, PortletContainerException;
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/8fb2d088/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortalDriverContainerServices.java
----------------------------------------------------------------------
diff --git a/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortalDriverContainerServices.java b/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortalDriverContainerServices.java
index f9fbd84..1508579 100644
--- a/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortalDriverContainerServices.java
+++ b/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortalDriverContainerServices.java
@@ -1,53 +1,53 @@
-/*
- * 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.pluto.container.driver;
-
-/**
- * Defines the additional services needed for the Pluto Portal Driver to integrate with the Pluto Container
- * and accessed from the <code>org.apache.pluto.container.driver.PortletServlet</code>
- * and the <code>org.apache.pluto.container.driver.impl.DefaultPortletInvokerService</code>.
- * These extra services are not required nor used by the container itself directly.
- *
- * @since 2.0
- * @version $Id$
- */
-public interface PortalDriverContainerServices
-{
-    /**
-     * Returns the portlet context services implementation
-     * used by the container.
-     *
-     * @return registry service implementation
-     */
-    PortletContextService getPortletContextService();
-
-    /**
-     * Returns the portlet registry services implementation
-     * used by the container.
-     *
-     * @return registry service implementation
-     */
-    PortletRegistryService getPortletRegistryService();
-
-    /**
-     * Returns the admin service implementation used by
-     * the container.
-     *
-     * @return portal admin service
-     */
-    PortalAdministrationService getPortalAdministrationService();
-}
+/*
+ * 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.pluto.container.driver;
+
+/**
+ * Defines the additional services needed for the Pluto Portal Driver to integrate with the Pluto Container
+ * and accessed from the <code>org.apache.pluto.container.driver.PortletServlet3</code>
+ * and the <code>org.apache.pluto.container.driver.impl.DefaultPortletInvokerService</code>.
+ * These extra services are not required nor used by the container itself directly.
+ *
+ * @since 2.0
+ * @version $Id$
+ */
+public interface PortalDriverContainerServices
+{
+    /**
+     * Returns the portlet context services implementation
+     * used by the container.
+     *
+     * @return registry service implementation
+     */
+    PortletContextService getPortletContextService();
+
+    /**
+     * Returns the portlet registry services implementation
+     * used by the container.
+     *
+     * @return registry service implementation
+     */
+    PortletRegistryService getPortletRegistryService();
+
+    /**
+     * Returns the admin service implementation used by
+     * the container.
+     *
+     * @return portal admin service
+     */
+    PortalAdministrationService getPortalAdministrationService();
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/8fb2d088/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortletContainerInitializer.java
----------------------------------------------------------------------
diff --git a/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortletContainerInitializer.java b/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortletContainerInitializer.java
index efb8d79..300b3af 100644
--- a/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortletContainerInitializer.java
+++ b/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortletContainerInitializer.java
@@ -24,7 +24,10 @@ import java.util.Set;
 import javax.servlet.ServletContainerInitializer;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
+import javax.servlet.ServletRegistration;
 
+import org.apache.pluto.container.PortletInvokerService;
+import org.apache.pluto.container.om.portlet.PortletDefinition;
 import org.apache.pluto.container.om.portlet.impl.ConfigurationHolder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -93,14 +96,40 @@ public class PortletContainerInitializer implements ServletContainerInitializer
                holder.processWebDD(win);
             }
 
-            ctx.setAttribute(ConfigurationHolder.ATTRIB_NAME, holder);
-            
+            if (holder.getPad().getPortlets().size() > 0) {
+               
+               // dynamically deploy the portlet servlets
+               for (PortletDefinition pd : holder.getPad().getPortlets()) {
+                  String pn = pd.getPortletName();
+                  String mapping = PortletInvokerService.URIPREFIX + pn;
+
+                  if (isDebug) {
+                     StringBuilder txt = new StringBuilder();
+                     txt.append("Adding PortletServlet3, name: ");
+                     txt.append(pn);
+                     txt.append(", mapping: ").append(mapping);
+                     LOG.debug(txt.toString());
+                  }
+                  
+                  ServletRegistration.Dynamic sr = ctx.addServlet(pn + "_PS3", PortletServlet3.class);
+                  sr.addMapping(mapping);
+                  sr.setInitParameter(PortletServlet3.PORTLET_NAME, pn);
+                  sr.setLoadOnStartup(100);
+
+               }
+
+               ctx.setAttribute(ConfigurationHolder.ATTRIB_NAME, holder);
+               
+            } else {
+               LOG.error("Configuration problem - no portlet definitions");
+            }
+
          } catch (Exception e) {
             StringBuilder txt = new StringBuilder(128);
-            txt.append("Exception reading portlet application configuration");
+            txt.append("Exception processing portlet application configuration");
             txt.append(", Servlet ctx name: ").append(
                   ctx.getServletContextName());
-            txt.append(", Exception: ").append(e.getLocalizedMessage());
+            txt.append(", Exception: ").append(e.toString());
             LOG.error(txt.toString());
          }
       }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/8fb2d088/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortletServlet.java
----------------------------------------------------------------------
diff --git a/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortletServlet.java b/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortletServlet.java
index 3962977..7b6d61d 100644
--- a/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortletServlet.java
+++ b/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortletServlet.java
@@ -1,469 +1,36 @@
-/*
- * 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.pluto.container.driver;
-
-import java.io.IOException;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.EventPortlet;
-import javax.portlet.EventRequest;
-import javax.portlet.EventResponse;
-import javax.portlet.Portlet;
-import javax.portlet.PortletConfig;
-import javax.portlet.PortletException;
-import javax.portlet.PortletRequest;
-import javax.portlet.PortletResponse;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.ResourceRequest;
-import javax.portlet.ResourceResponse;
-import javax.portlet.ResourceServingPortlet;
-import javax.portlet.UnavailableException;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.pluto.container.FilterManager;
-import org.apache.pluto.container.PortletContainerException;
-import org.apache.pluto.container.PortletInvokerService;
-import org.apache.pluto.container.PortletRequestContext;
-import org.apache.pluto.container.PortletResponseContext;
-import org.apache.pluto.container.PortletWindow;
-import org.apache.pluto.container.om.portlet.PortletDefinition;
-
-/**
- * Portlet Invocation Servlet. This servlet recieves cross context requests from
- * the the container and services the portlet request for the specified method.
- *
- * @version 1.1
- * @since 09/22/2004
- */
-public class PortletServlet extends HttpServlet
-{
-    private static final long serialVersionUID = -5096339022539360365L;
-
-    static class NullPortlet implements EventPortlet, ResourceServingPortlet, Portlet
-    {
-        public void processEvent(EventRequest arg0, EventResponse arg1)
-        throws PortletException, IOException
-        {
-        }
-
-        public void serveResource(ResourceRequest arg0, ResourceResponse arg1)
-        throws PortletException, IOException
-        {
-        }
-
-        public void destroy()
-        {
-        }
-
-        public void init(PortletConfig arg0) throws PortletException
-        {
-        }
-
-        public void processAction(ActionRequest arg0, ActionResponse arg1)
-        throws PortletException, IOException
-        {
-        }
-
-        public void render(RenderRequest arg0, RenderResponse arg1)
-        throws PortletException, IOException
-        {
-        }
-    }
-
-    // Private Member Variables ------------------------------------------------
-    /**
-     * The portlet name as defined in the portlet app descriptor.
-     */
-    private String portletName;
-
-    /**
-     * The portlet instance wrapped by this servlet.
-     */
-    private Portlet portlet;
-
-    /**
-     * The internal portlet context instance.
-     */
-    private DriverPortletContext portletContext;
-
-    /**
-     * The internal portlet config instance.
-     */
-    private DriverPortletConfig portletConfig;
-
-    /**
-     * The Event Portlet instance (the same object as portlet) wrapped by this
-     * servlet.
-     */
-    private EventPortlet eventPortlet;
-
-    /** The resource serving portlet instance wrapped by this servlet. */
-    private ResourceServingPortlet resourceServingPortlet;
-
-    private PortletContextService contextService;
-
-    private boolean started = false;
-    Timer   startTimer;
-
-    // HttpServlet Impl --------------------------------------------------------
-
-    public String getServletInfo()
-    {
-        return "Pluto PortletServlet [" + portletName + "]";
-    }
-
-    /**
-     * Initialize the portlet invocation servlet.
-     *
-     * @throws ServletException
-     *             if an error occurs while loading portlet.
-     */
-    public void init(ServletConfig config) throws ServletException
-    {
-
-        // Call the super initialization method.
-        super.init(config);
-
-        // Retrieve portlet name as defined as an initialization parameter.
-        portletName = getInitParameter("portlet-name");
-
-        started = false;
-
-        startTimer = new Timer(true);
-        final ServletContext servletContext = getServletContext();
-        final ClassLoader paClassLoader = Thread.currentThread().getContextClassLoader();
-        startTimer.schedule(new TimerTask()
-        {
-            public void run()
-            {
-                synchronized(servletContext)
-                {
-                    if (startTimer != null)
-                    {
-                        if (attemptRegistration(servletContext, paClassLoader ))
-                        {
-                            startTimer.cancel();
-                            startTimer = null;
-                        }
-                    }
-                }
-            }
-        }, 1, 10000);
-    }
-
-    protected boolean attemptRegistration(ServletContext context, ClassLoader paClassLoader)
-    {
-        if (PlutoServices.getServices() != null)
-        {
-            contextService = PlutoServices.getServices().getPortletContextService();
-            try
-            {
-                ServletConfig sConfig = getServletConfig();
-                if (sConfig == null)
-                {
-                    String msg = "Problem obtaining servlet configuration(getServletConfig() returns null).";
-                    context.log(msg);
-                    return true;
-                }
-
-                String applicationName = contextService.register(sConfig);
-                started = true;
-                portletContext = contextService.getPortletContext(applicationName);
-                portletConfig = contextService.getPortletConfig(applicationName, portletName);
-
-            }
-            catch (PortletContainerException ex)
-            {
-                context.log(ex.getMessage(),ex);
-                return true;
-            }
-
-            PortletDefinition portletDD = portletConfig.getPortletDefinition();
-
-            //          Create and initialize the portlet wrapped in the servlet.
-            try
-            {
-                Class<?> clazz = paClassLoader.loadClass((portletDD.getPortletClass()));
-                portlet = (Portlet) clazz.newInstance();
-                portlet.init(portletConfig);
-                initializeEventPortlet();
-                initializeResourceServingPortlet();
-                return true;
-            }
-            catch (Exception ex)
-            {
-                context.log(ex.getMessage(),ex);
-                // take out of service
-                portlet = null;
-                portletConfig = null;
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public void destroy()
-    {
-        synchronized(getServletContext())
-        {
-            if ( startTimer != null )
-            {
-                startTimer.cancel();
-                startTimer = null;
-            }
-            else if ( started && portletContext != null)
-            {
-                started = false;
-                contextService.unregister(portletContext);
-                if (portlet != null)
-                {
-                    try
-                    {
-                        portlet.destroy();
-                    }
-                    catch (Exception e)
-                    {
-                        // ignore
-                    }
-                    portlet = null;
-                }
-            }
-            super.destroy();
-        }
-    }
-
-    protected void doGet(HttpServletRequest request,
-            HttpServletResponse response) throws ServletException, IOException
-            {
-        dispatch(request, response);
-            }
-
-    protected void doPost(HttpServletRequest request,
-            HttpServletResponse response) throws ServletException, IOException
-            {
-        dispatch(request, response);
-            }
-
-    protected void doPut(HttpServletRequest request,
-            HttpServletResponse response) throws ServletException, IOException
-            {
-        dispatch(request, response);
-            }
-
-    // Private Methods ---------------------------------------------------------
-
-    /**
-     * Dispatch the request to the appropriate portlet methods. This method
-     * assumes that the following attributes are set in the servlet request
-     * scope:
-     * <ul>
-     * <li>METHOD_ID: indicating which method to dispatch.</li>
-     * <li>PORTLET_REQUEST: the internal portlet request.</li>
-     * <li>PORTLET_RESPONSE: the internal portlet response.</li>
-     * </ul>
-     *
-     * @param request
-     *            the servlet request.
-     * @param response
-     *            the servlet response.
-     * @throws ServletException
-     * @throws IOException
-     */
-    private void dispatch(HttpServletRequest request,
-            HttpServletResponse response) throws ServletException, IOException
-            {
-        if (portlet == null)
-        {
-            throw new javax.servlet.UnavailableException("Portlet "+portletName+" unavailable");
-        }
-
-        // Retrieve attributes from the servlet request.
-        Integer methodId = (Integer) request.getAttribute(PortletInvokerService.METHOD_ID);
-
-        final PortletRequest portletRequest = (PortletRequest)request.getAttribute(PortletInvokerService.PORTLET_REQUEST);
-
-        final PortletResponse portletResponse = (PortletResponse)request.getAttribute(PortletInvokerService.PORTLET_RESPONSE);
-
-        final PortletRequestContext requestContext = (PortletRequestContext)portletRequest.getAttribute(PortletInvokerService.REQUEST_CONTEXT);
-        final PortletResponseContext responseContext = (PortletResponseContext)portletRequest.getAttribute(PortletInvokerService.RESPONSE_CONTEXT);
-
-        final FilterManager filterManager = (FilterManager)request.getAttribute(PortletInvokerService.FILTER_MANAGER);
-
-        request.removeAttribute(PortletInvokerService.METHOD_ID);
-        request.removeAttribute(PortletInvokerService.PORTLET_REQUEST);
-        request.removeAttribute(PortletInvokerService.PORTLET_RESPONSE);
-        request.removeAttribute(PortletInvokerService.FILTER_MANAGER);
-
-        requestContext.init(portletConfig, getServletContext(), request, response);
-        responseContext.init(request, response);
-
-        PortletWindow window = requestContext.getPortletWindow();
-
-        PortletInvocationEvent event = new PortletInvocationEvent(portletRequest, window, methodId.intValue());
-
-        notify(event, true, null);
-
-        // FilterManager filtermanager = (FilterManager) request.getAttribute(
-        // "filter-manager");
-
-        try
-        {
-
-            // The requested method is RENDER: call Portlet.render(..)
-            if (methodId == PortletInvokerService.METHOD_RENDER)
-            {
-                RenderRequest renderRequest = (RenderRequest) portletRequest;
-                RenderResponse renderResponse = (RenderResponse) portletResponse;
-                filterManager.processFilter(renderRequest, renderResponse,
-                        portlet, portletContext);
-            }
-
-            // The requested method is RESOURCE: call
-            // ResourceServingPortlet.serveResource(..)
-            else if (methodId == PortletInvokerService.METHOD_RESOURCE)
-            {
-                ResourceRequest resourceRequest = (ResourceRequest) portletRequest;
-                ResourceResponse resourceResponse = (ResourceResponse) portletResponse;
-                filterManager.processFilter(resourceRequest, resourceResponse,
-                        resourceServingPortlet, portletContext);
-            }
-
-            // The requested method is ACTION: call Portlet.processAction(..)
-            else if (methodId == PortletInvokerService.METHOD_ACTION)
-            {
-                ActionRequest actionRequest = (ActionRequest) portletRequest;
-                ActionResponse actionResponse = (ActionResponse) portletResponse;
-                filterManager.processFilter(actionRequest, actionResponse,
-                        portlet, portletContext);
-            }
-
-            // The request methode is Event: call Portlet.processEvent(..)
-            else if (methodId == PortletInvokerService.METHOD_EVENT)
-            {
-                EventRequest eventRequest = (EventRequest) portletRequest;
-                EventResponse eventResponse = (EventResponse) portletResponse;
-                filterManager.processFilter(eventRequest, eventResponse,
-                        eventPortlet, portletContext);
-            }
-            // The requested method is ADMIN: call handlers.
-            else if (methodId == PortletInvokerService.METHOD_ADMIN)
-            {
-                PortalAdministrationService pas = PlutoServices.getServices().getPortalAdministrationService();
-
-                for (AdministrativeRequestListener l : pas.getAdministrativeRequestListeners())
-                {
-                    l.administer(portletRequest, portletResponse);
-                }
-            }
-
-            // The requested method is LOAD: do nothing.
-            else if (methodId == PortletInvokerService.METHOD_LOAD)
-            {
-                // Do nothing.
-            }
-
-            notify(event, false, null);
-
-        }
-        catch (UnavailableException ex)
-        {
-            //
-            // if (e.isPermanent()) { throw new
-            // UnavailableException(e.getMessage()); } else { throw new
-            // UnavailableException(e.getMessage(), e.getUnavailableSeconds());
-            // }
-            //
-
-            // Portlet.destroy() isn't called by Tomcat, so we have to fix it.
-            try
-            {
-                portlet.destroy();
-            }
-            catch (Throwable th)
-            {
-                // Don't care for Exception
-                this.getServletContext().log("Error during portlet destroy.", th);
-            }
-            // take portlet out of service
-            portlet = null;
-
-            // TODO: Handle everything as permanently for now.
-            throw new javax.servlet.UnavailableException(ex.getMessage());
-
-        }
-        catch (PortletException ex)
-        {
-            notify(event, false, ex);
-            throw new ServletException(ex);
-
-        }
-            }
-
-    protected void notify(PortletInvocationEvent event, boolean pre, Throwable e)
-    {
-        PortalAdministrationService pas = PlutoServices.getServices().getPortalAdministrationService();
-
-        for (PortletInvocationListener listener : pas.getPortletInvocationListeners())
-        {
-            if (pre)
-            {
-                listener.onBegin(event);
-            }
-            else if (e == null)
-            {
-                listener.onEnd(event);
-            }
-            else
-            {
-                listener.onError(event, e);
-            }
-        }
-    }
-
-    private void initializeEventPortlet()
-    {
-        if (portlet instanceof EventPortlet)
-        {
-            eventPortlet = (EventPortlet) portlet;
-        }
-        else
-        {
-            eventPortlet = new NullPortlet();
-        }
-    }
-
-    private void initializeResourceServingPortlet()
-    {
-        if (portlet instanceof ResourceServingPortlet)
-        {
-            resourceServingPortlet = (ResourceServingPortlet) portlet;
-        }
-        else
-        {
-            resourceServingPortlet = new NullPortlet();
-        }
-    }
-}
+/*  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.pluto.container.driver;
+
+import javax.servlet.http.HttpServlet;
+
+/**
+ * Dummy servlet to allow "legacy" portlets with web.xml files specifying PortletServlet to deploy properly.
+ * The real portlet servlet is PortletServlet3, which is deployed through the servlet container
+ * initializer.
+ * 
+ * @see PortletServlet3
+ * @see PortletContainerInitializer
+ * @author Scott Nicklous
+ */
+public class PortletServlet extends HttpServlet {
+   private static final long serialVersionUID = -2550104981099637033L;
+
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/8fb2d088/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortletServlet3.java
----------------------------------------------------------------------
diff --git a/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortletServlet3.java b/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortletServlet3.java
new file mode 100644
index 0000000..5f1f013
--- /dev/null
+++ b/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortletServlet3.java
@@ -0,0 +1,475 @@
+/*
+ * 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.pluto.container.driver;
+
+import java.io.IOException;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.EventPortlet;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.Portlet;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import javax.portlet.ResourceServingPortlet;
+import javax.portlet.UnavailableException;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.pluto.container.FilterManager;
+import org.apache.pluto.container.PortletContainerException;
+import org.apache.pluto.container.PortletInvokerService;
+import org.apache.pluto.container.PortletRequestContext;
+import org.apache.pluto.container.PortletResponseContext;
+import org.apache.pluto.container.PortletWindow;
+import org.apache.pluto.container.om.portlet.PortletDefinition;
+
+/**
+ * Portlet Invocation Servlet. This servlet recieves cross context requests from
+ * the the container and services the portlet request for the specified method.
+ *
+ * @version 1.1
+ * @since 09/22/2004
+ */
+public class PortletServlet3 extends HttpServlet
+{
+    private static final long serialVersionUID = -5096339022539360365L;
+    
+    /**
+     * Portlet name constant, needed by portlet container initializer
+     */
+    public static final String PORTLET_NAME = "portlet-name"; 
+
+
+    static class NullPortlet implements EventPortlet, ResourceServingPortlet, Portlet
+    {
+        public void processEvent(EventRequest arg0, EventResponse arg1)
+        throws PortletException, IOException
+        {
+        }
+
+        public void serveResource(ResourceRequest arg0, ResourceResponse arg1)
+        throws PortletException, IOException
+        {
+        }
+
+        public void destroy()
+        {
+        }
+
+        public void init(PortletConfig arg0) throws PortletException
+        {
+        }
+
+        public void processAction(ActionRequest arg0, ActionResponse arg1)
+        throws PortletException, IOException
+        {
+        }
+
+        public void render(RenderRequest arg0, RenderResponse arg1)
+        throws PortletException, IOException
+        {
+        }
+    }
+
+    // Private Member Variables ------------------------------------------------
+    /**
+     * The portlet name as defined in the portlet app descriptor.
+     */
+    private String portletName;
+
+    /**
+     * The portlet instance wrapped by this servlet.
+     */
+    private Portlet portlet;
+
+    /**
+     * The internal portlet context instance.
+     */
+    private DriverPortletContext portletContext;
+
+    /**
+     * The internal portlet config instance.
+     */
+    private DriverPortletConfig portletConfig;
+
+    /**
+     * The Event Portlet instance (the same object as portlet) wrapped by this
+     * servlet.
+     */
+    private EventPortlet eventPortlet;
+
+    /** The resource serving portlet instance wrapped by this servlet. */
+    private ResourceServingPortlet resourceServingPortlet;
+
+    private PortletContextService contextService;
+
+    private boolean started = false;
+    Timer   startTimer;
+
+    // HttpServlet Impl --------------------------------------------------------
+
+    public String getServletInfo()
+    {
+        return "Pluto PortletServlet3 [" + portletName + "]";
+    }
+
+    /**
+     * Initialize the portlet invocation servlet.
+     *
+     * @throws ServletException
+     *             if an error occurs while loading portlet.
+     */
+    public void init(ServletConfig config) throws ServletException
+    {
+
+        // Call the super initialization method.
+        super.init(config);
+
+        // Retrieve portlet name as defined as an initialization parameter.
+        portletName = getInitParameter(PORTLET_NAME);
+
+        started = false;
+
+        startTimer = new Timer(true);
+        final ServletContext servletContext = getServletContext();
+        final ClassLoader paClassLoader = Thread.currentThread().getContextClassLoader();
+        startTimer.schedule(new TimerTask()
+        {
+            public void run()
+            {
+                synchronized(servletContext)
+                {
+                    if (startTimer != null)
+                    {
+                        if (attemptRegistration(servletContext, paClassLoader ))
+                        {
+                            startTimer.cancel();
+                            startTimer = null;
+                        }
+                    }
+                }
+            }
+        }, 1, 10000);
+    }
+
+    protected boolean attemptRegistration(ServletContext context, ClassLoader paClassLoader)
+    {
+        if (PlutoServices.getServices() != null)
+        {
+            contextService = PlutoServices.getServices().getPortletContextService();
+            try
+            {
+                ServletConfig sConfig = getServletConfig();
+                if (sConfig == null)
+                {
+                    String msg = "Problem obtaining servlet configuration(getServletConfig() returns null).";
+                    context.log(msg);
+                    return true;
+                }
+
+                String applicationName = contextService.register(sConfig);
+                started = true;
+                portletContext = contextService.getPortletContext(applicationName);
+                portletConfig = contextService.getPortletConfig(applicationName, portletName);
+
+            }
+            catch (PortletContainerException ex)
+            {
+                context.log(ex.getMessage(),ex);
+                return true;
+            }
+
+            PortletDefinition portletDD = portletConfig.getPortletDefinition();
+
+            //          Create and initialize the portlet wrapped in the servlet.
+            try
+            {
+                Class<?> clazz = paClassLoader.loadClass((portletDD.getPortletClass()));
+                portlet = (Portlet) clazz.newInstance();
+                portlet.init(portletConfig);
+                initializeEventPortlet();
+                initializeResourceServingPortlet();
+                return true;
+            }
+            catch (Exception ex)
+            {
+                context.log(ex.getMessage(),ex);
+                // take out of service
+                portlet = null;
+                portletConfig = null;
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public void destroy()
+    {
+        synchronized(getServletContext())
+        {
+            if ( startTimer != null )
+            {
+                startTimer.cancel();
+                startTimer = null;
+            }
+            else if ( started && portletContext != null)
+            {
+                started = false;
+                contextService.unregister(portletContext);
+                if (portlet != null)
+                {
+                    try
+                    {
+                        portlet.destroy();
+                    }
+                    catch (Exception e)
+                    {
+                        // ignore
+                    }
+                    portlet = null;
+                }
+            }
+            super.destroy();
+        }
+    }
+
+    protected void doGet(HttpServletRequest request,
+            HttpServletResponse response) throws ServletException, IOException
+            {
+        dispatch(request, response);
+            }
+
+    protected void doPost(HttpServletRequest request,
+            HttpServletResponse response) throws ServletException, IOException
+            {
+        dispatch(request, response);
+            }
+
+    protected void doPut(HttpServletRequest request,
+            HttpServletResponse response) throws ServletException, IOException
+            {
+        dispatch(request, response);
+            }
+
+    // Private Methods ---------------------------------------------------------
+
+    /**
+     * Dispatch the request to the appropriate portlet methods. This method
+     * assumes that the following attributes are set in the servlet request
+     * scope:
+     * <ul>
+     * <li>METHOD_ID: indicating which method to dispatch.</li>
+     * <li>PORTLET_REQUEST: the internal portlet request.</li>
+     * <li>PORTLET_RESPONSE: the internal portlet response.</li>
+     * </ul>
+     *
+     * @param request
+     *            the servlet request.
+     * @param response
+     *            the servlet response.
+     * @throws ServletException
+     * @throws IOException
+     */
+    private void dispatch(HttpServletRequest request,
+            HttpServletResponse response) throws ServletException, IOException
+            {
+        if (portlet == null)
+        {
+            throw new javax.servlet.UnavailableException("Portlet "+portletName+" unavailable");
+        }
+
+        // Retrieve attributes from the servlet request.
+        Integer methodId = (Integer) request.getAttribute(PortletInvokerService.METHOD_ID);
+
+        final PortletRequest portletRequest = (PortletRequest)request.getAttribute(PortletInvokerService.PORTLET_REQUEST);
+
+        final PortletResponse portletResponse = (PortletResponse)request.getAttribute(PortletInvokerService.PORTLET_RESPONSE);
+
+        final PortletRequestContext requestContext = (PortletRequestContext)portletRequest.getAttribute(PortletInvokerService.REQUEST_CONTEXT);
+        final PortletResponseContext responseContext = (PortletResponseContext)portletRequest.getAttribute(PortletInvokerService.RESPONSE_CONTEXT);
+
+        final FilterManager filterManager = (FilterManager)request.getAttribute(PortletInvokerService.FILTER_MANAGER);
+
+        request.removeAttribute(PortletInvokerService.METHOD_ID);
+        request.removeAttribute(PortletInvokerService.PORTLET_REQUEST);
+        request.removeAttribute(PortletInvokerService.PORTLET_RESPONSE);
+        request.removeAttribute(PortletInvokerService.FILTER_MANAGER);
+
+        requestContext.init(portletConfig, getServletContext(), request, response);
+        responseContext.init(request, response);
+
+        PortletWindow window = requestContext.getPortletWindow();
+
+        PortletInvocationEvent event = new PortletInvocationEvent(portletRequest, window, methodId.intValue());
+
+        notify(event, true, null);
+
+        // FilterManager filtermanager = (FilterManager) request.getAttribute(
+        // "filter-manager");
+
+        try
+        {
+
+            // The requested method is RENDER: call Portlet.render(..)
+            if (methodId == PortletInvokerService.METHOD_RENDER)
+            {
+                RenderRequest renderRequest = (RenderRequest) portletRequest;
+                RenderResponse renderResponse = (RenderResponse) portletResponse;
+                filterManager.processFilter(renderRequest, renderResponse,
+                        portlet, portletContext);
+            }
+
+            // The requested method is RESOURCE: call
+            // ResourceServingPortlet.serveResource(..)
+            else if (methodId == PortletInvokerService.METHOD_RESOURCE)
+            {
+                ResourceRequest resourceRequest = (ResourceRequest) portletRequest;
+                ResourceResponse resourceResponse = (ResourceResponse) portletResponse;
+                filterManager.processFilter(resourceRequest, resourceResponse,
+                        resourceServingPortlet, portletContext);
+            }
+
+            // The requested method is ACTION: call Portlet.processAction(..)
+            else if (methodId == PortletInvokerService.METHOD_ACTION)
+            {
+                ActionRequest actionRequest = (ActionRequest) portletRequest;
+                ActionResponse actionResponse = (ActionResponse) portletResponse;
+                filterManager.processFilter(actionRequest, actionResponse,
+                        portlet, portletContext);
+            }
+
+            // The request methode is Event: call Portlet.processEvent(..)
+            else if (methodId == PortletInvokerService.METHOD_EVENT)
+            {
+                EventRequest eventRequest = (EventRequest) portletRequest;
+                EventResponse eventResponse = (EventResponse) portletResponse;
+                filterManager.processFilter(eventRequest, eventResponse,
+                        eventPortlet, portletContext);
+            }
+            // The requested method is ADMIN: call handlers.
+            else if (methodId == PortletInvokerService.METHOD_ADMIN)
+            {
+                PortalAdministrationService pas = PlutoServices.getServices().getPortalAdministrationService();
+
+                for (AdministrativeRequestListener l : pas.getAdministrativeRequestListeners())
+                {
+                    l.administer(portletRequest, portletResponse);
+                }
+            }
+
+            // The requested method is LOAD: do nothing.
+            else if (methodId == PortletInvokerService.METHOD_LOAD)
+            {
+                // Do nothing.
+            }
+
+            notify(event, false, null);
+
+        }
+        catch (UnavailableException ex)
+        {
+            //
+            // if (e.isPermanent()) { throw new
+            // UnavailableException(e.getMessage()); } else { throw new
+            // UnavailableException(e.getMessage(), e.getUnavailableSeconds());
+            // }
+            //
+
+            // Portlet.destroy() isn't called by Tomcat, so we have to fix it.
+            try
+            {
+                portlet.destroy();
+            }
+            catch (Throwable th)
+            {
+                // Don't care for Exception
+                this.getServletContext().log("Error during portlet destroy.", th);
+            }
+            // take portlet out of service
+            portlet = null;
+
+            // TODO: Handle everything as permanently for now.
+            throw new javax.servlet.UnavailableException(ex.getMessage());
+
+        }
+        catch (PortletException ex)
+        {
+            notify(event, false, ex);
+            throw new ServletException(ex);
+
+        }
+            }
+
+    protected void notify(PortletInvocationEvent event, boolean pre, Throwable e)
+    {
+        PortalAdministrationService pas = PlutoServices.getServices().getPortalAdministrationService();
+
+        for (PortletInvocationListener listener : pas.getPortletInvocationListeners())
+        {
+            if (pre)
+            {
+                listener.onBegin(event);
+            }
+            else if (e == null)
+            {
+                listener.onEnd(event);
+            }
+            else
+            {
+                listener.onError(event, e);
+            }
+        }
+    }
+
+    private void initializeEventPortlet()
+    {
+        if (portlet instanceof EventPortlet)
+        {
+            eventPortlet = (EventPortlet) portlet;
+        }
+        else
+        {
+            eventPortlet = new NullPortlet();
+        }
+    }
+
+    private void initializeResourceServingPortlet()
+    {
+        if (portlet instanceof ResourceServingPortlet)
+        {
+            resourceServingPortlet = (ResourceServingPortlet) portlet;
+        }
+        else
+        {
+            resourceServingPortlet = new NullPortlet();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/8fb2d088/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationProcessor.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationProcessor.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationProcessor.java
index bfd6c6e..204b5d7 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationProcessor.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationProcessor.java
@@ -98,7 +98,7 @@ public abstract class ConfigurationProcessor {
    protected void checkValidClass(String clsName, Class<?> assignable, String msg) {
    
       StringBuilder txt = new StringBuilder(128);
-      txt.append(msg);
+      txt.append(msg).append(", class name: ");
       txt.append(clsName);
       if (!isValidIdentifier(clsName)) {
          txt.append(". Invalid java identifier.");
@@ -109,7 +109,7 @@ public abstract class ConfigurationProcessor {
       // Make sure the class can be loaded
       Class<?> valClass = null;
       try {
-         ClassLoader cl = this.getClass().getClassLoader();
+         ClassLoader cl = Thread.currentThread().getContextClassLoader();
          valClass = cl.loadClass(clsName);
          if (assignable != null && !assignable.isAssignableFrom(valClass)) {
             txt.append(". Specified class is not a ");
@@ -117,7 +117,8 @@ public abstract class ConfigurationProcessor {
             throw new Exception();
          }
       } catch (ClassNotFoundException e) {
-         LOG.warn(txt.toString() + e.getLocalizedMessage());
+         txt.append(", Exception: ").append(e.toString());
+         LOG.warn(txt.toString());
          // can't throw exception if class not found, since the portlet
          // application definition is used by the assembly mojo
       } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/8fb2d088/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/DefaultPortletInvokerService.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/DefaultPortletInvokerService.java b/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/DefaultPortletInvokerService.java
index 30ddfaa..32c097f 100644
--- a/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/DefaultPortletInvokerService.java
+++ b/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/DefaultPortletInvokerService.java
@@ -42,7 +42,7 @@ import org.apache.pluto.container.PortletInvokerService;
 import org.apache.pluto.container.PortletRequestContext;
 import org.apache.pluto.container.PortletWindow;
 import org.apache.pluto.container.driver.PortletContextService;
-import org.apache.pluto.container.driver.PortletServlet;
+import org.apache.pluto.container.driver.PortletServlet3;
 import org.apache.pluto.container.util.StringManager;
 
 /**
@@ -65,11 +65,6 @@ public class DefaultPortletInvokerService implements PortletInvokerService {
 
     // Private Member Variables ------------------------------------------------
 
-    /** URI prefix of the portlet invoker servlet.
-     *  TODO: this is Pluto Portal Driver specific!
-     * */
-    private static final String PREFIX = "/PlutoInvoker/";
-
     private PortletContextService portletContextService;
 
     // Constructor -------------------------------------------------------------
@@ -90,7 +85,7 @@ public class DefaultPortletInvokerService implements PortletInvokerService {
      * @param context request context used for the invocation
      * @param request  action request used for the invocation.
      * @param response action response used for the invocation.
-     * @see PortletServlet
+     * @see PortletServlet3
      * @see javax.portlet.Portlet#processAction(javax.portlet.ActionRequest,javax.portlet.ActionResponse)
      */
     public void action(PortletRequestContext context, ActionRequest request, ActionResponse response, FilterManager filterManager)
@@ -106,7 +101,7 @@ public class DefaultPortletInvokerService implements PortletInvokerService {
      *
      * @param request  action request used for the invocation.
      * @param response action response used for the invocation.
-     * @see PortletServlet
+     * @see PortletServlet3
      * @see javax.portlet.Portlet#render(javax.portlet.RenderRequest,javax.portlet.RenderResponse)
      */
     public void render(PortletRequestContext context, RenderRequest request, RenderResponse response, FilterManager filterManager)
@@ -122,7 +117,7 @@ public class DefaultPortletInvokerService implements PortletInvokerService {
      *
      * @param request  action request used for the invocation.
      * @param response action response used for the invocation.
-     * @see PortletServlet
+     * @see PortletServlet3
      * @see javax.portlet.Portlet#render(javax.portlet.RenderRequest,javax.portlet.RenderResponse)
      */
     public void event(PortletRequestContext context, EventRequest request, EventResponse response, FilterManager filterManager)
@@ -138,7 +133,7 @@ public class DefaultPortletInvokerService implements PortletInvokerService {
      *
      * @param request  resource request used for the invocation.
      * @param response resource response used for the invocation.
-     * @see PortletServlet
+     * @see PortletServlet3
      * @see javax.portlet.Portlet#resource(javax.portlet.ResourceRequest,javax.portlet.ResourceResponse)
      */
     public void serveResource(PortletRequestContext context, ResourceRequest request, ResourceResponse response, FilterManager filterManager)
@@ -154,7 +149,7 @@ public class DefaultPortletInvokerService implements PortletInvokerService {
      *
      * @param request  action request used for the invocation.
      * @param response action response used for the invocation.
-     * @see PortletServlet
+     * @see PortletServlet3
      */
     public void load(PortletRequestContext context, PortletRequest request, PortletResponse response)
     throws IOException, PortletException, PortletContainerException {
@@ -205,7 +200,7 @@ public class DefaultPortletInvokerService implements PortletInvokerService {
         String appName = portletWindow.getPortletDefinition().getApplication().getName();
         ServletContext servletContext = portletContextService.getPortletContext(appName).getServletContext();
 
-        String uri =  PREFIX + portletWindow.getPortletDefinition().getPortletName();
+        String uri =  PortletInvokerService.URIPREFIX + portletWindow.getPortletDefinition().getPortletName();
         if (LOG.isDebugEnabled()) {
             LOG.debug("Dispatching to portlet servlet at: " + uri);
         }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/8fb2d088/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/PortletDescriptorRegistry.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/PortletDescriptorRegistry.java b/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/PortletDescriptorRegistry.java
index 79094e7..87b6b6a 100644
--- a/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/PortletDescriptorRegistry.java
+++ b/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/PortletDescriptorRegistry.java
@@ -16,7 +16,6 @@
  */
 package org.apache.pluto.driver.container;
 
-import java.io.InputStream;
 import java.util.Map;
 import java.util.WeakHashMap;
 
@@ -48,13 +47,6 @@ public class PortletDescriptorRegistry {
    private static final Logger LOG = LoggerFactory
          .getLogger(PortletDescriptorRegistry.class);
    private static final boolean isDebug = LOG.isDebugEnabled();
-   
-
-   /** Web deployment descriptor location. */
-   private static final String WEB_XML     = "/WEB-INF/web.xml";
-
-   /** Portlet deployment descriptor location. */
-   private static final String PORTLET_XML = "/WEB-INF/portlet.xml";
 
    /** Exception Messages. */
    private static final StringManager EXCEPTIONS  = StringManager.getManager(PortletDescriptorRegistry.class
@@ -64,6 +56,7 @@ public class PortletDescriptorRegistry {
    // Private Member Variables ------------------------------------------------
 
    /** The portlet application descriptor service. */
+   @SuppressWarnings("unused")
    private final PortletAppDescriptorService                       portletDDService;
 
    /**
@@ -107,7 +100,8 @@ public class PortletDescriptorRegistry {
    // Private Methods ---------------------------------------------------------
 
    /**
-    * Creates the portlet.xml deployment descriptor representation.
+    * Creates and retisters the portlet application configuration based on the
+    * config data read by the PortletContainerInitializer.
     * 
     * @param servletContext
     *           the servlet context for which the DD is requested.
@@ -133,30 +127,9 @@ public class PortletDescriptorRegistry {
          portletApp.setName(name);
          
       } else {
-         
-         if (isDebug) {
-            LOG.debug("Reading portlet config. ctx path: " + contextPath);
-         }
-
-         try {
-            InputStream paIn = servletContext.getResourceAsStream(PORTLET_XML);
-            InputStream webIn = servletContext.getResourceAsStream(WEB_XML);
-            if (paIn == null) {
-               throw new PortletContainerException("Cannot find '"
-                     + PORTLET_XML
-                     + "'. Are you sure it is in the deployed package?");
-            }
-            if (webIn == null) {
-               throw new PortletContainerException("Cannot find '" + WEB_XML
-                     + "'. Are you sure it is in the deployed package?");
-            }
-            portletApp = portletDDService.read(name, contextPath, paIn);
-            portletDDService.mergeWebDescriptor(portletApp, webIn);
-         } catch (Exception ex) {
             throw new PortletContainerException(EXCEPTIONS.getString(
                   "error.context.descriptor.load",
-                  new String[] { servletContext.getServletContextName() }), ex);
-         }
+                  new String[] { servletContext.getServletContextName(), "No config data stored in context." }));
       }
       return portletApp;
    }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/8fb2d088/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 7a6a2e8..debae93 100644
--- a/pom.xml
+++ b/pom.xml
@@ -269,6 +269,7 @@ generate mailto links. -->
     <commons-cli.version>1.0</commons-cli.version>
     <slf4j.version>1.7.5</slf4j.version>
     <springframework.version>2.0.2</springframework.version>
+<!--     <springframework.version>4.2.3.RELEASE</springframework.version> -->
     <maven.version>2.0.5</maven.version>
     <ant.version>1.6.5</ant.version>
     <commons-io.version>2.4</commons-io.version>