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:03 UTC

[22/38] portals-pluto git commit: Started step-wise refinement to move to ServletContainerInitializer for initializing the portlet applications and pluto portlet container. Added container initializer that reads the portlet DD. modified the descriptor re

Started step-wise refinement to move to ServletContainerInitializer for
initializing the portlet applications and pluto portlet container. Added
container initializer that reads the portlet DD. modified the descriptor
registry to use the config read ny the initializer.


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

Branch: refs/heads/V3Prototype
Commit: 15356530d5e9161350bf7ab3a3ba97539968c6c5
Parents: 094449e
Author: Scott Nicklous <ms...@apache.org>
Authored: Tue Nov 17 15:18:36 2015 +0100
Committer: Scott Nicklous <ms...@apache.org>
Committed: Tue Nov 17 15:18:36 2015 +0100

----------------------------------------------------------------------
 .../pluto/maven/InstallationDependency.java     |   1 +
 pluto-container-driver-api/pom.xml              | 126 ++--
 .../driver/PortletContainerInitializer.java     | 110 +++
 .../javax.servlet.ServletContainerInitializer   |   1 +
 pluto-container/pom.xml                         |   2 +-
 .../impl/HttpServletPortletResponseWrapper.java | 678 ++++++++++---------
 .../om/portlet/impl/ConfigurationHolder.java    |   2 +
 .../util/DummyServletOutputStream.java          | 244 +++----
 .../util/PrintWriterServletOutputStream.java    | 278 ++++----
 pluto-portal-driver-impl/pom.xml                |   7 +
 pluto-portal-driver/pom.xml                     |   8 +
 .../container/PortletDescriptorRegistry.java    | 298 ++++----
 pluto-portal/pom.xml                            |   1 +
 pluto-testsuite/pom.xml                         |   4 +-
 pom.xml                                         |   8 +-
 15 files changed, 985 insertions(+), 783 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/15356530/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/InstallationDependency.java
----------------------------------------------------------------------
diff --git a/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/InstallationDependency.java b/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/InstallationDependency.java
index 5854075..8aec848 100644
--- a/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/InstallationDependency.java
+++ b/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/InstallationDependency.java
@@ -144,6 +144,7 @@ class InstallationDependency {
 
     static {
         SHARED.add(PORTLET_API);
+        SHARED.add(CONTAINER);
         SHARED.add(CONTAINER_API);
         SHARED.add(CONTAINER_DRIVER_API);
         SHARED.add(TAGLIB);

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/15356530/pluto-container-driver-api/pom.xml
----------------------------------------------------------------------
diff --git a/pluto-container-driver-api/pom.xml b/pluto-container-driver-api/pom.xml
index a4bad16..915bf55 100644
--- a/pluto-container-driver-api/pom.xml
+++ b/pluto-container-driver-api/pom.xml
@@ -1,62 +1,70 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.portals.pluto</groupId>
-    <artifactId>pluto</artifactId>
-    <version>3.0-SNAPSHOT</version>
-  </parent>
-
-  <artifactId>pluto-container-driver-api</artifactId>
-  <packaging>bundle</packaging>
-  <name>Apache Pluto Container Driver API</name>
-
-  <dependencies>
-    <!-- Specification Libraries =========================================== -->
-    <dependency>
-      <groupId>org.apache.portals.pluto</groupId>
-      <artifactId>portlet-api</artifactId>
-      <version>${project.version}</version>
-      <scope>provided</scope>
-    </dependency>
-    
-    <dependency>
-      <groupId>org.apache.tomcat</groupId>
-      <artifactId>tomcat-servlet-api</artifactId>
-      <scope>provided</scope>
-    </dependency>
-
-    <!--  CCPP Libraries -->
-    <dependency>
-      <groupId>javax.ccpp</groupId>
-      <artifactId>ccpp</artifactId>
-      <scope>provided</scope>
-    </dependency>
-
-    <dependency>
+<!-- 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. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
+>
+
+   <modelVersion>4.0.0</modelVersion>
+   <parent>
       <groupId>org.apache.portals.pluto</groupId>
-      <artifactId>pluto-container-api</artifactId>
-      <version>${project.version}</version>
-      <scope>compile</scope>
-    </dependency>
-  </dependencies>
+      <artifactId>pluto</artifactId>
+      <version>3.0-SNAPSHOT</version>
+   </parent>
+
+   <artifactId>pluto-container-driver-api</artifactId>
+   <packaging>bundle</packaging>
+   <name>Apache Pluto Container Driver API</name>
+
+   <dependencies>
+      <!-- Specification Libraries =========================================== -->
+      <dependency>
+         <groupId>org.apache.portals.pluto</groupId>
+         <artifactId>portlet-api</artifactId>
+         <version>${project.version}</version>
+         <scope>provided</scope>
+      </dependency>
+
+      <dependency>
+         <groupId>org.apache.tomcat</groupId>
+         <artifactId>tomcat-servlet-api</artifactId>
+         <scope>provided</scope>
+      </dependency>
+
+      <!-- CCPP Libraries -->
+      <dependency>
+         <groupId>javax.ccpp</groupId>
+         <artifactId>ccpp</artifactId>
+         <scope>provided</scope>
+      </dependency>
+
+      <dependency>
+         <groupId>org.apache.portals.pluto</groupId>
+         <artifactId>pluto-container-api</artifactId>
+         <version>${project.version}</version>
+         <scope>compile</scope>
+      </dependency>
+
+      <dependency>
+         <groupId>org.apache.portals.pluto</groupId>
+         <artifactId>pluto-container</artifactId>
+         <version>${project.version}</version>
+         <scope>provided</scope>
+      </dependency>
+
+      <!-- Other Support Libraries =========================================== -->
+      <dependency>
+         <groupId>org.slf4j</groupId>
+         <artifactId>slf4j-api</artifactId>
+         <scope>provided</scope>
+      </dependency>
+   </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/15356530/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
new file mode 100644
index 0000000..efb8d79
--- /dev/null
+++ b/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortletContainerInitializer.java
@@ -0,0 +1,110 @@
+/*  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.InputStream;
+import java.util.Set;
+
+import javax.servlet.ServletContainerInitializer;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+import org.apache.pluto.container.om.portlet.impl.ConfigurationHolder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Servlet container initializer that reads the configuration and adds the
+ * portlet servlets for any portlets contained in the application.
+ * 
+ * @author Scott Nicklous
+ * 
+ */
+// @HandlesTypes({PortletApplication.class, PortletConfiguration.class})
+public class PortletContainerInitializer implements ServletContainerInitializer {
+
+   private static final String WEB_XML     = "/WEB-INF/web.xml";
+   private static final String PORTLET_XML = "/WEB-INF/portlet.xml";
+
+   /** Logger. */
+   private static final Logger LOG         = LoggerFactory
+                                                 .getLogger(PortletContainerInitializer.class);
+   private static boolean      isDebug     = LOG.isDebugEnabled();
+
+   /*
+    * (non-Javadoc)
+    * 
+    * @see javax.servlet.ServletContainerInitializer#onStartup(java.util.Set,
+    * javax.servlet.ServletContext)
+    */
+   @Override
+   public void onStartup(Set<Class<?>> classes, ServletContext ctx)
+         throws ServletException {
+
+      InputStream win = ctx.getResourceAsStream(WEB_XML);
+      InputStream pin = ctx.getResourceAsStream(PORTLET_XML);
+
+      if (isDebug) {
+         StringBuilder txt = new StringBuilder(128);
+         txt.append("ยงยงยง ServletContainerInitializer. ctx path: ").append(
+               ctx.getContextPath());
+         txt.append(", servlet ctx name: ").append(ctx.getServletContextName());
+         txt.append(", # portlet annotations: ").append(
+               (classes != null) ? classes.size() : "null");
+         txt.append(", found web.xml: ").append(win != null);
+         txt.append(", found portlet.xml: ").append(pin != null);
+         LOG.debug(txt.toString());
+      }
+
+      // If portlet configuration is available, parse it and launch the portlet
+      // servlets
+      if ((classes != null && classes.size() > 0) || pin != null) {
+
+         try {
+            ConfigurationHolder holder = new ConfigurationHolder();
+
+            if (classes != null) {
+               // digest any & all configuration annotations
+            }
+
+            if (pin != null) {
+               // parse the portlet deployment descriptor
+               holder.processPortletDD(pin);
+            }
+
+            if (win != null) {
+               // parse the web app deployment descriptor
+               holder.processWebDD(win);
+            }
+
+            ctx.setAttribute(ConfigurationHolder.ATTRIB_NAME, holder);
+            
+         } catch (Exception e) {
+            StringBuilder txt = new StringBuilder(128);
+            txt.append("Exception reading portlet application configuration");
+            txt.append(", Servlet ctx name: ").append(
+                  ctx.getServletContextName());
+            txt.append(", Exception: ").append(e.getLocalizedMessage());
+            LOG.error(txt.toString());
+         }
+      }
+
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/15356530/pluto-container-driver-api/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer
----------------------------------------------------------------------
diff --git a/pluto-container-driver-api/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer b/pluto-container-driver-api/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer
new file mode 100644
index 0000000..9471946
--- /dev/null
+++ b/pluto-container-driver-api/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer
@@ -0,0 +1 @@
+org.apache.pluto.container.driver.PortletContainerInitializer
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/15356530/pluto-container/pom.xml
----------------------------------------------------------------------
diff --git a/pluto-container/pom.xml b/pluto-container/pom.xml
index e3129c0..1108ace 100644
--- a/pluto-container/pom.xml
+++ b/pluto-container/pom.xml
@@ -37,7 +37,7 @@
       <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
-         <scope>compile</scope>
+         <scope>provided</scope>
       </dependency>
 
       <!-- Specification Libraries =========================================== -->

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/15356530/pluto-container/src/main/java/org/apache/pluto/container/impl/HttpServletPortletResponseWrapper.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/impl/HttpServletPortletResponseWrapper.java b/pluto-container/src/main/java/org/apache/pluto/container/impl/HttpServletPortletResponseWrapper.java
index 010fedd..6b93fda 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/impl/HttpServletPortletResponseWrapper.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/impl/HttpServletPortletResponseWrapper.java
@@ -1,333 +1,345 @@
-/*
- * 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.impl;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.util.Locale;
-
-import javax.portlet.ActionResponse;
-import javax.portlet.MimeResponse;
-import javax.portlet.PortletRequest;
-import javax.portlet.PortletResponse;
-import javax.portlet.ResourceResponse;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpServletResponseWrapper;
-
-import org.apache.pluto.container.util.DummyPrintWriter;
-import org.apache.pluto.container.util.DummyServletOutputStream;
-
-/**
- * @author <a href="mailto:ate@douma.nu">Ate Douma</a>
- * @version $Id$
- */
-public class HttpServletPortletResponseWrapper extends HttpServletResponseWrapper
-{
-    private final boolean forwarded;
-    private final PortletResponse portletResponse;
-    private final MimeResponse mimeResponse;
-    private final String lifecyclePhase;
-    private boolean included;
-    private OutputStream outputStream;
-    private ServletOutputStream servletOutputStream;
-    
-    public HttpServletPortletResponseWrapper(HttpServletResponse response, PortletRequest portletRequest, PortletResponse portletResponse, boolean included)
-    {
-        super(response);
-        this.portletResponse = portletResponse;
-        this.lifecyclePhase = (String)portletRequest.getAttribute(PortletRequest.LIFECYCLE_PHASE);
-        this.mimeResponse = PortletRequest.RENDER_PHASE.equals(lifecyclePhase) || PortletRequest.RESOURCE_PHASE.equals(lifecyclePhase) ? (MimeResponse)portletResponse : null;
-        this.forwarded = !included;
-        this.included = included;
-    }
-    
-    public void setIncluded(boolean included)
-    {
-        this.included = included;
-    }
-    
-    @Override
-    public void addCookie(Cookie cookie)
-    {
-        if (forwarded && !included)
-        {
-            portletResponse.addProperty(cookie);
-        }
-    }
-
-    @Override
-    public void addDateHeader(String name, long date)
-    {
-        if (forwarded && !included && mimeResponse != null)
-        {
-            mimeResponse.addProperty(name, Long.toString(date));
-        }
-    }
-
-    @Override
-    public void addHeader(String name, String value)
-    {
-        if (forwarded && !included && mimeResponse != null)
-        {
-            mimeResponse.addProperty(name, value);
-        }
-    }
-
-    @Override
-    public void addIntHeader(String name, int value)
-    {
-        if (forwarded && !included && mimeResponse != null)
-        {
-            mimeResponse.addProperty(name, Integer.toString(value));
-        }
-    }
-
-    @Override
-    public boolean containsHeader(String name)
-    {
-        return false;
-    }
-
-    @Override
-    public String encodeRedirectUrl(String url)
-    {
-        return null;
-    }
-
-    @Override
-    public String encodeRedirectURL(String url)
-    {
-        return null;
-    }
-
-    @Override
-    public String encodeUrl(String url)
-    {
-        return encodeURL(url);
-    }
-
-    @Override
-    public String encodeURL(String url)
-    {
-        if (url != null && url.indexOf("://") == -1 && !url.startsWith("/"))
-        {
-            // The Portlet Spec only allows URL encoding for absolute or full path URIs
-            // Letting this pass through thus would lead to an IllegalArgumentException been thrown.
-
-            // TODO: figure out how (if not impossible) this can be (pre)fixed properly
-            return url;
-        }
-        return portletResponse.encodeURL(url);
-    }
-
-    @Override
-    public void sendError(int sc, String msg) throws IOException
-    {
-    }
-
-    @Override
-    public void sendError(int sc) throws IOException
-    {
-    }
-
-    @Override
-    public void sendRedirect(String location) throws IOException
-    {
-        if (forwarded && !included && PortletRequest.ACTION_PHASE.equals(lifecyclePhase))
-        {
-            ((ActionResponse)portletResponse).sendRedirect(location);
-        }
-    }
-
-    @Override
-    public void setDateHeader(String name, long date)
-    {
-        if (forwarded && !included && mimeResponse != null)
-        {
-            mimeResponse.setProperty(name, Long.toString(date));
-        }
-    }
-
-    @Override
-    public void setHeader(String name, String value)
-    {
-        if (forwarded && !included && mimeResponse != null)
-        {
-            mimeResponse.setProperty(name, value);
-        }
-    }
-
-    @Override
-    public void setIntHeader(String name, int value)
-    {
-        if (forwarded && !included && mimeResponse != null)
-        {
-            mimeResponse.setProperty(name, Integer.toString(value));
-        }
-    }
-
-    @Override
-    public void setStatus(int sc, String sm)
-    {
-        setStatus(sc);
-    }
-
-    @Override
-    public void setStatus(int sc)
-    {
-        if (forwarded && !included && PortletRequest.RESOURCE_PHASE.equals(lifecyclePhase))
-        {
-            mimeResponse.setProperty(ResourceResponse.HTTP_STATUS_CODE, Integer.toString(sc));
-        }
-    }
-
-    @Override
-    public void flushBuffer() throws IOException
-    {
-        if (mimeResponse != null)
-        {
-            mimeResponse.flushBuffer();
-        }            
-    }
-
-    @Override
-    public int getBufferSize()
-    {
-        return mimeResponse != null ? mimeResponse.getBufferSize() : 0;
-    }
-
-    @Override
-    public String getCharacterEncoding()
-    {
-        return mimeResponse != null ? mimeResponse.getCharacterEncoding() : null;
-    }
-
-    @Override
-    public String getContentType()
-    {
-        return mimeResponse != null ? mimeResponse.getContentType() : null;
-    }
-
-    @Override
-    public Locale getLocale()
-    {
-        return mimeResponse != null ? mimeResponse.getLocale() : null;
-    }
-
-    @Override
-    public ServletOutputStream getOutputStream() throws IOException
-    {
-    	if (servletOutputStream == null)
-    	{
-        	outputStream = mimeResponse != null ? mimeResponse.getPortletOutputStream() : DummyServletOutputStream.getInstance();
-        	if (outputStream instanceof ServletOutputStream)
-        	{
-        		servletOutputStream = (ServletOutputStream)outputStream;
-        	}
-        	else
-        	{
-        		servletOutputStream = new ServletOutputStream()
-        		{
-					@Override
-					public void write(int b) throws IOException 
-					{
-						outputStream.write(b);
-					}
-        		};
-        	}
-    	}
-    	return servletOutputStream;
-    }
-
-    @Override
-    public PrintWriter getWriter() throws IOException
-    {
-        return mimeResponse != null ? mimeResponse.getWriter() : DummyPrintWriter.getInstance();
-    }
-
-    @Override
-    public boolean isCommitted()
-    {
-        return mimeResponse != null ? mimeResponse.isCommitted() : forwarded ? false : true;
-    }
-
-    @Override
-    public void reset()
-    {
-        if (mimeResponse != null)
-        {
-            mimeResponse.reset();
-        }
-    }
-
-    @Override
-    public void resetBuffer()
-    {
-        if (mimeResponse != null)
-        {
-            mimeResponse.resetBuffer();
-        }
-    }
-
-    @Override
-    public void setBufferSize(int size)
-    {
-        if (mimeResponse != null)
-        {
-            mimeResponse.setBufferSize(size);
-        }
-    }
-
-    @Override
-    public void setCharacterEncoding(String charset)
-    {
-        if (forwarded && !included && PortletRequest.RESOURCE_PHASE.equals(lifecyclePhase))
-        {
-            ((ResourceResponse)portletResponse).setCharacterEncoding(charset);
-        }
-    }
-
-    @Override
-    public void setContentLength(int len)
-    {
-        if (forwarded && !included && PortletRequest.RESOURCE_PHASE.equals(lifecyclePhase))
-        {
-            ((ResourceResponse)portletResponse).setContentLength(len);
-        }
-    }
-
-    @Override
-    public void setContentType(String type)
-    {
-        if (forwarded && !included && mimeResponse != null)
-        {
-            mimeResponse.setContentType(type);
-        }
-    }
-
-    @Override
-    public void setLocale(Locale loc)
-    {
-        if (forwarded && !included && PortletRequest.RESOURCE_PHASE.equals(lifecyclePhase))
-        {
-            ((ResourceResponse)portletResponse).setLocale(loc);
-        }
-    }    
-}
+/*
+ * 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.impl;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.Locale;
+
+import javax.portlet.ActionResponse;
+import javax.portlet.MimeResponse;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.ResourceResponse;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
+
+import org.apache.pluto.container.util.DummyPrintWriter;
+import org.apache.pluto.container.util.DummyServletOutputStream;
+
+/**
+ * @author <a href="mailto:ate@douma.nu">Ate Douma</a>
+ * @version $Id$
+ */
+public class HttpServletPortletResponseWrapper extends HttpServletResponseWrapper
+{
+    private final boolean forwarded;
+    private final PortletResponse portletResponse;
+    private final MimeResponse mimeResponse;
+    private final String lifecyclePhase;
+    private boolean included;
+    private OutputStream outputStream;
+    private ServletOutputStream servletOutputStream;
+    
+    public HttpServletPortletResponseWrapper(HttpServletResponse response, PortletRequest portletRequest, PortletResponse portletResponse, boolean included)
+    {
+        super(response);
+        this.portletResponse = portletResponse;
+        this.lifecyclePhase = (String)portletRequest.getAttribute(PortletRequest.LIFECYCLE_PHASE);
+        this.mimeResponse = PortletRequest.RENDER_PHASE.equals(lifecyclePhase) || PortletRequest.RESOURCE_PHASE.equals(lifecyclePhase) ? (MimeResponse)portletResponse : null;
+        this.forwarded = !included;
+        this.included = included;
+    }
+    
+    public void setIncluded(boolean included)
+    {
+        this.included = included;
+    }
+    
+    @Override
+    public void addCookie(Cookie cookie)
+    {
+        if (forwarded && !included)
+        {
+            portletResponse.addProperty(cookie);
+        }
+    }
+
+    @Override
+    public void addDateHeader(String name, long date)
+    {
+        if (forwarded && !included && mimeResponse != null)
+        {
+            mimeResponse.addProperty(name, Long.toString(date));
+        }
+    }
+
+    @Override
+    public void addHeader(String name, String value)
+    {
+        if (forwarded && !included && mimeResponse != null)
+        {
+            mimeResponse.addProperty(name, value);
+        }
+    }
+
+    @Override
+    public void addIntHeader(String name, int value)
+    {
+        if (forwarded && !included && mimeResponse != null)
+        {
+            mimeResponse.addProperty(name, Integer.toString(value));
+        }
+    }
+
+    @Override
+    public boolean containsHeader(String name)
+    {
+        return false;
+    }
+
+    @Override
+    public String encodeRedirectUrl(String url)
+    {
+        return null;
+    }
+
+    @Override
+    public String encodeRedirectURL(String url)
+    {
+        return null;
+    }
+
+    @Override
+    public String encodeUrl(String url)
+    {
+        return encodeURL(url);
+    }
+
+    @Override
+    public String encodeURL(String url)
+    {
+        if (url != null && url.indexOf("://") == -1 && !url.startsWith("/"))
+        {
+            // The Portlet Spec only allows URL encoding for absolute or full path URIs
+            // Letting this pass through thus would lead to an IllegalArgumentException been thrown.
+
+            // TODO: figure out how (if not impossible) this can be (pre)fixed properly
+            return url;
+        }
+        return portletResponse.encodeURL(url);
+    }
+
+    @Override
+    public void sendError(int sc, String msg) throws IOException
+    {
+    }
+
+    @Override
+    public void sendError(int sc) throws IOException
+    {
+    }
+
+    @Override
+    public void sendRedirect(String location) throws IOException
+    {
+        if (forwarded && !included && PortletRequest.ACTION_PHASE.equals(lifecyclePhase))
+        {
+            ((ActionResponse)portletResponse).sendRedirect(location);
+        }
+    }
+
+    @Override
+    public void setDateHeader(String name, long date)
+    {
+        if (forwarded && !included && mimeResponse != null)
+        {
+            mimeResponse.setProperty(name, Long.toString(date));
+        }
+    }
+
+    @Override
+    public void setHeader(String name, String value)
+    {
+        if (forwarded && !included && mimeResponse != null)
+        {
+            mimeResponse.setProperty(name, value);
+        }
+    }
+
+    @Override
+    public void setIntHeader(String name, int value)
+    {
+        if (forwarded && !included && mimeResponse != null)
+        {
+            mimeResponse.setProperty(name, Integer.toString(value));
+        }
+    }
+
+    @Override
+    public void setStatus(int sc, String sm)
+    {
+        setStatus(sc);
+    }
+
+    @Override
+    public void setStatus(int sc)
+    {
+        if (forwarded && !included && PortletRequest.RESOURCE_PHASE.equals(lifecyclePhase))
+        {
+            mimeResponse.setProperty(ResourceResponse.HTTP_STATUS_CODE, Integer.toString(sc));
+        }
+    }
+
+    @Override
+    public void flushBuffer() throws IOException
+    {
+        if (mimeResponse != null)
+        {
+            mimeResponse.flushBuffer();
+        }            
+    }
+
+    @Override
+    public int getBufferSize()
+    {
+        return mimeResponse != null ? mimeResponse.getBufferSize() : 0;
+    }
+
+    @Override
+    public String getCharacterEncoding()
+    {
+        return mimeResponse != null ? mimeResponse.getCharacterEncoding() : null;
+    }
+
+    @Override
+    public String getContentType()
+    {
+        return mimeResponse != null ? mimeResponse.getContentType() : null;
+    }
+
+    @Override
+    public Locale getLocale()
+    {
+        return mimeResponse != null ? mimeResponse.getLocale() : null;
+    }
+
+    @Override
+    public ServletOutputStream getOutputStream() throws IOException
+    {
+    	if (servletOutputStream == null)
+    	{
+        	outputStream = mimeResponse != null ? mimeResponse.getPortletOutputStream() : DummyServletOutputStream.getInstance();
+        	if (outputStream instanceof ServletOutputStream)
+        	{
+        		servletOutputStream = (ServletOutputStream)outputStream;
+        	}
+        	else
+        	{
+        		servletOutputStream = new ServletOutputStream()
+        		{
+					@Override
+					public void write(int b) throws IOException 
+					{
+						outputStream.write(b);
+					}
+
+               @Override
+               public boolean isReady() {
+                  // Servlet 3.1 API. Not implemented.
+                  return true;
+               }
+
+               @Override
+               public void setWriteListener(WriteListener arg0) {
+                  // Servlet 3.1 API. Not implemented.
+               }
+        		};
+        	}
+    	}
+    	return servletOutputStream;
+    }
+
+    @Override
+    public PrintWriter getWriter() throws IOException
+    {
+        return mimeResponse != null ? mimeResponse.getWriter() : DummyPrintWriter.getInstance();
+    }
+
+    @Override
+    public boolean isCommitted()
+    {
+        return mimeResponse != null ? mimeResponse.isCommitted() : forwarded ? false : true;
+    }
+
+    @Override
+    public void reset()
+    {
+        if (mimeResponse != null)
+        {
+            mimeResponse.reset();
+        }
+    }
+
+    @Override
+    public void resetBuffer()
+    {
+        if (mimeResponse != null)
+        {
+            mimeResponse.resetBuffer();
+        }
+    }
+
+    @Override
+    public void setBufferSize(int size)
+    {
+        if (mimeResponse != null)
+        {
+            mimeResponse.setBufferSize(size);
+        }
+    }
+
+    @Override
+    public void setCharacterEncoding(String charset)
+    {
+        if (forwarded && !included && PortletRequest.RESOURCE_PHASE.equals(lifecyclePhase))
+        {
+            ((ResourceResponse)portletResponse).setCharacterEncoding(charset);
+        }
+    }
+
+    @Override
+    public void setContentLength(int len)
+    {
+        if (forwarded && !included && PortletRequest.RESOURCE_PHASE.equals(lifecyclePhase))
+        {
+            ((ResourceResponse)portletResponse).setContentLength(len);
+        }
+    }
+
+    @Override
+    public void setContentType(String type)
+    {
+        if (forwarded && !included && mimeResponse != null)
+        {
+            mimeResponse.setContentType(type);
+        }
+    }
+
+    @Override
+    public void setLocale(Locale loc)
+    {
+        if (forwarded && !included && PortletRequest.RESOURCE_PHASE.equals(lifecyclePhase))
+        {
+            ((ResourceResponse)portletResponse).setLocale(loc);
+        }
+    }    
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/15356530/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationHolder.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationHolder.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationHolder.java
index f93904e..1acf42b 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationHolder.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationHolder.java
@@ -43,6 +43,8 @@ import org.slf4j.LoggerFactory;
  * 
  */
 public class ConfigurationHolder {
+   
+   public static final String ATTRIB_NAME = "PortletAppConfig";
 
    private PortletApplicationDefinition   pad = null;
    private ConfigurationProcessor         jcp = null;

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/15356530/pluto-container/src/main/java/org/apache/pluto/container/util/DummyServletOutputStream.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/util/DummyServletOutputStream.java b/pluto-container/src/main/java/org/apache/pluto/container/util/DummyServletOutputStream.java
index 5cd9821..5da4dbe 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/util/DummyServletOutputStream.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/util/DummyServletOutputStream.java
@@ -1,117 +1,127 @@
-/*
- * 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.util;
-
-import java.io.IOException;
-
-import javax.servlet.ServletOutputStream;
-
-public final class DummyServletOutputStream extends ServletOutputStream{
-
-    private static final ServletOutputStream instance = new DummyServletOutputStream();
-    
-    public static ServletOutputStream getInstance()
-    {
-        return instance;
-    }
-    
-    private DummyServletOutputStream()
-    {
-    }
-    
-	@Override
-	public void write(int b) throws IOException {
-	}
-
-	@Override
-	public void print(boolean arg0) throws IOException {
-	}
-
-	@Override
-	public void print(char arg0) throws IOException {
-	}
-
-	@Override
-	public void print(double arg0) throws IOException {
-	}
-
-	@Override
-	public void print(float arg0) throws IOException {
-	}
-
-	@Override
-	public void print(int arg0) throws IOException {
-	}
-
-	@Override
-	public void print(long arg0) throws IOException {
-	}
-
-	@Override
-	public void print(String arg0) throws IOException {
-	}
-
-	@Override
-	public void println() throws IOException {
-	}
-
-	@Override
-	public void println(boolean arg0) throws IOException {
-	}
-
-	@Override
-	public void println(char arg0) throws IOException {
-	}
-
-	@Override
-	public void println(double arg0) throws IOException {
-	}
-
-	@Override
-	public void println(float arg0) throws IOException {
-	}
-
-	@Override
-	public void println(int arg0) throws IOException {
-	}
-
-	@Override
-	public void println(long arg0) throws IOException {
-	}
-
-	@Override
-	public void println(String arg0) throws IOException {
-	}
-
-	@Override
-	public void close() throws IOException {
-	}
-
-	@Override
-	public void flush() throws IOException {
-	}
-
-	@Override
-	public void write(byte[] b, int off, int len) throws IOException {
-	}
-
-	@Override
-	public void write(byte[] b) throws IOException {
-	}
-
-	
-}
+/*
+ * 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.util;
+
+import java.io.IOException;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
+
+public final class DummyServletOutputStream extends ServletOutputStream{
+
+    private static final ServletOutputStream instance = new DummyServletOutputStream();
+    
+    public static ServletOutputStream getInstance()
+    {
+        return instance;
+    }
+    
+    private DummyServletOutputStream()
+    {
+    }
+    
+	@Override
+	public void write(int b) throws IOException {
+	}
+
+	@Override
+	public void print(boolean arg0) throws IOException {
+	}
+
+	@Override
+	public void print(char arg0) throws IOException {
+	}
+
+	@Override
+	public void print(double arg0) throws IOException {
+	}
+
+	@Override
+	public void print(float arg0) throws IOException {
+	}
+
+	@Override
+	public void print(int arg0) throws IOException {
+	}
+
+	@Override
+	public void print(long arg0) throws IOException {
+	}
+
+	@Override
+	public void print(String arg0) throws IOException {
+	}
+
+	@Override
+	public void println() throws IOException {
+	}
+
+	@Override
+	public void println(boolean arg0) throws IOException {
+	}
+
+	@Override
+	public void println(char arg0) throws IOException {
+	}
+
+	@Override
+	public void println(double arg0) throws IOException {
+	}
+
+	@Override
+	public void println(float arg0) throws IOException {
+	}
+
+	@Override
+	public void println(int arg0) throws IOException {
+	}
+
+	@Override
+	public void println(long arg0) throws IOException {
+	}
+
+	@Override
+	public void println(String arg0) throws IOException {
+	}
+
+	@Override
+	public void close() throws IOException {
+	}
+
+	@Override
+	public void flush() throws IOException {
+	}
+
+	@Override
+	public void write(byte[] b, int off, int len) throws IOException {
+	}
+
+	@Override
+	public void write(byte[] b) throws IOException {
+	}
+
+   @Override
+   public boolean isReady() {
+      return true;
+   }
+
+   @Override
+   public void setWriteListener(WriteListener arg0) {
+   }
+
+	
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/15356530/pluto-container/src/main/java/org/apache/pluto/container/util/PrintWriterServletOutputStream.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/util/PrintWriterServletOutputStream.java b/pluto-container/src/main/java/org/apache/pluto/container/util/PrintWriterServletOutputStream.java
index 6975d6d..93ae3f2 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/util/PrintWriterServletOutputStream.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/util/PrintWriterServletOutputStream.java
@@ -1,133 +1,145 @@
-/*
- * 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.util;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.UnsupportedEncodingException;
-
-import javax.servlet.ServletOutputStream;
-
-/**
- * This is a specialized class implementing a ServletOutputStream that works in
- * conjunction with a PrintWriter to send data to the browser. It is used when a
- * J2EE server throws an IllegalStateException when you call getOutputStream on
- * a response which someone has previously called getWriter on.
- */
-public class PrintWriterServletOutputStream extends ServletOutputStream {
-
-    /**
-     * The PrintWriter that is wrapped on top of the base input stream
-     */
-    PrintWriter mPrintWriter;
-
-    /**
-     * The character encoding of the response.
-     */
-    private String characterEncoding;
-
-    public PrintWriterServletOutputStream(PrintWriter pw, String encoding)
-    {
-        super();
-        mPrintWriter = pw;
-        characterEncoding = encoding;
-    }
-    
-    /**
-     * Writes an array of bytes
-     * @param pBuf the array to be written
-     * @throws IOException if an I/O error occurred
-     */
-    public void write(byte[] pBuf) throws IOException {
-        this.write(pBuf, 0, pBuf.length);
-    }
-
-    /**
-     * Writes a single byte to the output stream
-     */
-    public void write(int pVal) throws IOException {
-        mPrintWriter.write(pVal);
-    }
-
-    /**
-     * Writes a subarray of bytes
-     * @param pBuf    the array to be written
-     * @param pOffset the offset into the array
-     * @param pLength the number of bytes to write
-     * @throws IOException if an I/O error occurred
-     */
-    public void write(byte[] pBuf, int pOffset, int pLength)
-        throws IOException {
-        String strValue = null;
-        if(characterEncoding != null && !"".equals(characterEncoding)) {
-            try {
-                strValue = new String(pBuf, pOffset, pLength, characterEncoding);
-            }
-            catch(UnsupportedEncodingException uee) {
-                // ignore and allow the null to handle.
-            }
-        }
-
-        if(strValue == null) {
-            strValue = new String(pBuf, pOffset, pLength);
-        }
-
-        mPrintWriter.write(strValue);
-    }
-
-    /**
-     * Flushes the stream, writing any buffered output bytes
-     * @throws IOException if an I/O error occurred
-     */
-    public void flush() throws IOException {
-        mPrintWriter.flush();
-    }
-
-    /**
-     * Closes the stream
-     * @throws IOException if an I/O error occurred
-     */
-    public void close() throws IOException {
-        mPrintWriter.close();
-    }
-
-    /**
-     * Prints a string.
-     * @param pVal the String to be printed
-     * @throws IOException if an I/O error has occurred
-     */
-    public void print(String pVal) throws IOException {
-        mPrintWriter.print(pVal);
-    }
-
-    /**
-     * Prints an string followed by a CRLF.
-     * @param pVal the String to be printed
-     * @throws IOException if an I/O error has occurred
-     */
-    public void println(String pVal) throws IOException {
-        mPrintWriter.println(pVal);
-    }
-
-    /**
-     * Prints a CRLF
-     * @throws IOException if an I/O error has occurred
-     */
-    public void println() throws IOException {
-        mPrintWriter.println();
-    }
-}
+/*
+ * 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.util;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
+
+/**
+ * This is a specialized class implementing a ServletOutputStream that works in
+ * conjunction with a PrintWriter to send data to the browser. It is used when a
+ * J2EE server throws an IllegalStateException when you call getOutputStream on
+ * a response which someone has previously called getWriter on.
+ */
+public class PrintWriterServletOutputStream extends ServletOutputStream {
+
+    /**
+     * The PrintWriter that is wrapped on top of the base input stream
+     */
+    PrintWriter mPrintWriter;
+
+    /**
+     * The character encoding of the response.
+     */
+    private String characterEncoding;
+
+    public PrintWriterServletOutputStream(PrintWriter pw, String encoding)
+    {
+        super();
+        mPrintWriter = pw;
+        characterEncoding = encoding;
+    }
+    
+    /**
+     * Writes an array of bytes
+     * @param pBuf the array to be written
+     * @throws IOException if an I/O error occurred
+     */
+    public void write(byte[] pBuf) throws IOException {
+        this.write(pBuf, 0, pBuf.length);
+    }
+
+    /**
+     * Writes a single byte to the output stream
+     */
+    public void write(int pVal) throws IOException {
+        mPrintWriter.write(pVal);
+    }
+
+    /**
+     * Writes a subarray of bytes
+     * @param pBuf    the array to be written
+     * @param pOffset the offset into the array
+     * @param pLength the number of bytes to write
+     * @throws IOException if an I/O error occurred
+     */
+    public void write(byte[] pBuf, int pOffset, int pLength)
+        throws IOException {
+        String strValue = null;
+        if(characterEncoding != null && !"".equals(characterEncoding)) {
+            try {
+                strValue = new String(pBuf, pOffset, pLength, characterEncoding);
+            }
+            catch(UnsupportedEncodingException uee) {
+                // ignore and allow the null to handle.
+            }
+        }
+
+        if(strValue == null) {
+            strValue = new String(pBuf, pOffset, pLength);
+        }
+
+        mPrintWriter.write(strValue);
+    }
+
+    /**
+     * Flushes the stream, writing any buffered output bytes
+     * @throws IOException if an I/O error occurred
+     */
+    public void flush() throws IOException {
+        mPrintWriter.flush();
+    }
+
+    /**
+     * Closes the stream
+     * @throws IOException if an I/O error occurred
+     */
+    public void close() throws IOException {
+        mPrintWriter.close();
+    }
+
+    /**
+     * Prints a string.
+     * @param pVal the String to be printed
+     * @throws IOException if an I/O error has occurred
+     */
+    public void print(String pVal) throws IOException {
+        mPrintWriter.print(pVal);
+    }
+
+    /**
+     * Prints an string followed by a CRLF.
+     * @param pVal the String to be printed
+     * @throws IOException if an I/O error has occurred
+     */
+    public void println(String pVal) throws IOException {
+        mPrintWriter.println(pVal);
+    }
+
+    /**
+     * Prints a CRLF
+     * @throws IOException if an I/O error has occurred
+     */
+    public void println() throws IOException {
+        mPrintWriter.println();
+    }
+
+   @Override
+   public boolean isReady() {
+      // Servlet 3.1 API. not implemented; always ready. 
+      return true;
+   }
+
+   @Override
+   public void setWriteListener(WriteListener arg0) {
+      // Servlet 3.1 API. not implemented.
+   }
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/15356530/pluto-portal-driver-impl/pom.xml
----------------------------------------------------------------------
diff --git a/pluto-portal-driver-impl/pom.xml b/pluto-portal-driver-impl/pom.xml
index 786e16c..1102f58 100644
--- a/pluto-portal-driver-impl/pom.xml
+++ b/pluto-portal-driver-impl/pom.xml
@@ -74,6 +74,13 @@
       <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
+    
+    <!-- Other Support Libraries =========================================== -->
+    <dependency>
+       <groupId>org.slf4j</groupId>
+       <artifactId>slf4j-api</artifactId>
+       <scope>provided</scope>
+    </dependency>
 
     <dependency>
       <groupId>org.apache.portals.pluto</groupId>

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/15356530/pluto-portal-driver/pom.xml
----------------------------------------------------------------------
diff --git a/pluto-portal-driver/pom.xml b/pluto-portal-driver/pom.xml
index 8457627..ad8b481 100644
--- a/pluto-portal-driver/pom.xml
+++ b/pluto-portal-driver/pom.xml
@@ -129,6 +129,14 @@
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
     </dependency>
+    
+    <!-- Other Support Libraries =========================================== -->
+    <dependency>
+       <groupId>org.slf4j</groupId>
+       <artifactId>slf4j-api</artifactId>
+       <scope>provided</scope>
+    </dependency>
+
 
     <!-- Testing Libraries ================================================= -->
     <dependency>

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/15356530/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 b84f2e9..79094e7 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
@@ -1,134 +1,164 @@
-/*
- * 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.driver.container;
-
-import java.io.InputStream;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import javax.servlet.ServletContext;
-
-import org.apache.pluto.container.PortletAppDescriptorService;
-import org.apache.pluto.container.PortletContainerException;
-import org.apache.pluto.container.driver.PlutoConfigurationException;
-import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;
-import org.apache.pluto.container.util.StringManager;
-
-/**
- * Simple caching mechanism used to manage portlet descriptors. This mechanism
- * takes special considerations to make sure that the cache is invalidated for
- * any ServletContext that is destroyed, thus allowing for a the context to be
- * redeployed.
- *
- * NOTE: This should only be used internally.  Do not access it from embedding
- * portals, instead, utilize the PortletRegistryService.
- *
- * @version 1.0
- * @since Nov 3, 2004
- */
-public class PortletDescriptorRegistry {
-
-    /** 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.getPackage().getName());
-
-    // Private Member Variables ------------------------------------------------
-
-    /** The portlet application descriptor service. */
-    private final PortletAppDescriptorService portletDDService;
-
-    /**
-     * Cache of descriptors.  WeakHashMap is used so that
-     * once the context is destroyed (kinda), the cache is eliminated.
-     * Ideally we'd use a ServletContextListener, but at this
-     * point I'm wondering if we really want to add another
-     * config requirement in the servlet xml? Hmm. . .
-     */
-    private final Map<ServletContext, PortletApplicationDefinition> cache = new WeakHashMap<ServletContext, PortletApplicationDefinition>();
-
-
-    // Constructor -------------------------------------------------------------
-
-    //someone didn't want this accessible externally.
-    PortletDescriptorRegistry(PortletAppDescriptorService portletDDService)
-    {
-        this.portletDDService = portletDDService;
-    }
-
-    // Public Methods ----------------------------------------------------------
-
-    /**
-     * Retrieve the Portlet Application Deployment Descriptor for the given
-     * servlet context.  Create it if it does not allready exist.
-     *
-     * @param servletContext  the servlet context.
-     * @return The portlet application deployment descriptor.
-     * @throws PortletContainerException if the descriptor can not be found or parsed
-     */
-    public PortletApplicationDefinition getPortletAppDD(ServletContext servletContext, String name, String contextPath)
-    throws PortletContainerException {
-        PortletApplicationDefinition portletApp = cache.get(servletContext);
-        if (portletApp == null) {
-        	portletApp = createDefinition(servletContext, name, contextPath);
-            cache.put(servletContext, portletApp);
-        }
-        return portletApp;
-    }
-
-
-    // Private Methods ---------------------------------------------------------
-
-    /**
-     * Creates the portlet.xml deployment descriptor representation.
-     *
-     * @param servletContext  the servlet context for which the DD is requested.
-     * @return the Portlet Application Deployment Descriptor.
-     * @throws PortletContainerException
-     */
-    private PortletApplicationDefinition createDefinition(ServletContext servletContext, String name, String contextPath)
-    throws PortletContainerException {
-        PortletApplicationDefinition portletApp = null;
-        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);
-        }
-        return portletApp;
-    }
-
-}
-
+/*
+ * 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.driver.container;
+
+import java.io.InputStream;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import javax.servlet.ServletContext;
+
+import org.apache.pluto.container.PortletAppDescriptorService;
+import org.apache.pluto.container.PortletContainerException;
+import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;
+import org.apache.pluto.container.om.portlet.impl.ConfigurationHolder;
+import org.apache.pluto.container.util.StringManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Simple caching mechanism used to manage portlet descriptors. This mechanism
+ * takes special considerations to make sure that the cache is invalidated for
+ * any ServletContext that is destroyed, thus allowing for a the context to be
+ * redeployed.
+ * 
+ * NOTE: This should only be used internally. Do not access it from embedding
+ * portals, instead, utilize the PortletRegistryService.
+ * 
+ * @version 1.0
+ * @since Nov 3, 2004
+ */
+public class PortletDescriptorRegistry {
+   
+   /** Logger. */
+   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
+                                                                                           .getPackage()
+                                                                                           .getName());
+
+   // Private Member Variables ------------------------------------------------
+
+   /** The portlet application descriptor service. */
+   private final PortletAppDescriptorService                       portletDDService;
+
+   /**
+    * Cache of descriptors. WeakHashMap is used so that once the context is
+    * destroyed (kinda), the cache is eliminated. Ideally we'd use a
+    * ServletContextListener, but at this point I'm wondering if we really want
+    * to add another config requirement in the servlet xml? Hmm. . .
+    */
+   private final Map<ServletContext, PortletApplicationDefinition> cache       = new WeakHashMap<ServletContext, PortletApplicationDefinition>();
+
+   // Constructor -------------------------------------------------------------
+
+   // someone didn't want this accessible externally.
+   PortletDescriptorRegistry(PortletAppDescriptorService portletDDService) {
+      this.portletDDService = portletDDService;
+   }
+
+   // Public Methods ----------------------------------------------------------
+
+   /**
+    * Retrieve the Portlet Application Deployment Descriptor for the given
+    * servlet context. Create it if it does not allready exist.
+    * 
+    * @param servletContext
+    *           the servlet context.
+    * @return The portlet application deployment descriptor.
+    * @throws PortletContainerException
+    *            if the descriptor can not be found or parsed
+    */
+   public PortletApplicationDefinition getPortletAppDD(
+         ServletContext servletContext, String name, String contextPath)
+         throws PortletContainerException {
+      PortletApplicationDefinition portletApp = cache.get(servletContext);
+      if (portletApp == null) {
+         portletApp = createDefinition(servletContext, name, contextPath);
+         cache.put(servletContext, portletApp);
+      }
+      return portletApp;
+   }
+
+   // Private Methods ---------------------------------------------------------
+
+   /**
+    * Creates the portlet.xml deployment descriptor representation.
+    * 
+    * @param servletContext
+    *           the servlet context for which the DD is requested.
+    * @return the Portlet Application Deployment Descriptor.
+    * @throws PortletContainerException
+    */
+   private PortletApplicationDefinition createDefinition(
+         ServletContext servletContext, String name, String contextPath)
+         throws PortletContainerException {
+      
+      PortletApplicationDefinition portletApp = null;
+      ConfigurationHolder holder = (ConfigurationHolder) servletContext
+            .getAttribute(ConfigurationHolder.ATTRIB_NAME);
+      
+      if (holder != null) {
+         
+         if (isDebug) {
+            LOG.debug("Registering config initializer. ctx path: " + contextPath);
+         }
+         
+         portletApp = holder.getPad();
+         portletApp.setContextPath(contextPath);
+         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);
+         }
+      }
+      return portletApp;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/15356530/pluto-portal/pom.xml
----------------------------------------------------------------------
diff --git a/pluto-portal/pom.xml b/pluto-portal/pom.xml
index 8364b94..f523a3c 100644
--- a/pluto-portal/pom.xml
+++ b/pluto-portal/pom.xml
@@ -35,6 +35,7 @@
       <groupId>org.apache.portals.pluto</groupId>
       <artifactId>pluto-container</artifactId>
       <version>${project.version}</version>
+      <scope>provided</scope>
       <exclusions>
         <exclusion>
           <groupId>org.apache.portals.pluto</groupId>

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/15356530/pluto-testsuite/pom.xml
----------------------------------------------------------------------
diff --git a/pluto-testsuite/pom.xml b/pluto-testsuite/pom.xml
index bb4f09d..3ed6d48 100644
--- a/pluto-testsuite/pom.xml
+++ b/pluto-testsuite/pom.xml
@@ -72,12 +72,12 @@
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
-            <scope>${dependency.scope}</scope>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-jdk14</artifactId>
-            <scope>${dependency.scope}</scope>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/15356530/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index d262334..7a6a2e8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -257,10 +257,10 @@ generate mailto links. -->
     <javax.portlet.version.major>3</javax.portlet.version.major>
     <javax.portlet.version.minor>0</javax.portlet.version.minor>
     <portals.portlet-api.version>${project.version}</portals.portlet-api.version>
-    <servlet-api.version>7.0.50</servlet-api.version>
-    <jsp-api.version>7.0.50</jsp-api.version>
-    <jstl.version>7.0.50</jstl.version>
-    <el-api.version>7.0.50</el-api.version>
+    <servlet-api.version>8.0.28</servlet-api.version>
+    <jsp-api.version>8.0.28</jsp-api.version>
+    <jstl.version>8.0.28</jstl.version>
+    <el-api.version>8.0.28</el-api.version>
     <taglibs.standard.version>1.2.1</taglibs.standard.version>
     <jaxb.version>2.1</jaxb.version>
     <jaxb-impl.version>2.1.9</jaxb-impl.version>