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 at...@apache.org on 2009/03/14 04:17:05 UTC

svn commit: r753592 [2/2] - in /portals/pluto/trunk: pluto-container-api/src/main/java/org/apache/pluto/container/ pluto-container-api/src/main/java/org/apache/pluto/container/driver/ pluto-container-api/src/main/java/org/apache/pluto/container/om/port...

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/HttpServletPortletRequestWrapper.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/HttpServletPortletRequestWrapper.java?rev=753592&r1=753591&r2=753592&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/HttpServletPortletRequestWrapper.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/HttpServletPortletRequestWrapper.java Sat Mar 14 03:17:03 2009
@@ -23,9 +23,12 @@
 import java.security.Principal;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Collections;
 import java.util.Date;
 import java.util.Enumeration;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Locale;
 import java.util.Map;
 
@@ -34,14 +37,17 @@
 import javax.servlet.RequestDispatcher;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletInputStream;
+import javax.servlet.ServletRequest;
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequestWrapper;
 import javax.servlet.http.HttpSession;
 
-import org.apache.pluto.container.Constants;
+import org.apache.pluto.container.PortletInvokerService;
 import org.apache.pluto.container.PortletRequestContext;
 import org.apache.pluto.container.RequestDispatcherPathInfo;
+import org.apache.pluto.container.RequestDispatcherPathInfoProvider;
+import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;
 
 /**
  * @author <a href="mailto:ate@douma.nu">Ate Douma</a>
@@ -49,41 +55,6 @@
  */
 public class HttpServletPortletRequestWrapper extends HttpServletRequestWrapper
 {
-    private static class PortletRequestParametersWrapper extends HttpServletRequestWrapper
-    {
-        private PortletRequest portletRequest;
-        
-        public PortletRequestParametersWrapper(HttpServletRequest request, PortletRequest portletRequest)
-        {
-            super(request);
-            this.portletRequest = portletRequest;
-        }
-
-        @Override
-        public String getParameter(String name)
-        {
-            return portletRequest.getParameter(name);
-        }
-
-        @Override
-        public Map<String, String[]> getParameterMap()
-        {
-            return portletRequest.getParameterMap();
-        }
-
-        @Override
-        public Enumeration<String> getParameterNames()
-        {
-            return portletRequest.getParameterNames();
-        }
-
-        @Override
-        public String[] getParameterValues(String name)
-        {
-            return portletRequest.getParameterValues(name);
-        }        
-    }
-    
     private static final String INCLUDE_CONTEXT_PATH = "javax.servlet.include.context_path";
     private static final String INCLUDE_PATH_INFO = "javax.servlet.include.path_info";
     private static final String INCLUDE_QUERY_STRING = "javax.servlet.include.query_string";
@@ -95,6 +66,18 @@
     private static final String FORWARD_REQUEST_URI = "javax.servlet.forward.request_uri";
     private static final String FORWARD_SERVLET_PATH = "javax.servlet.forward.servlet_path";
     
+    private static final HashSet<String> pathInfoAttributes = 
+        new HashSet<String>(Arrays.asList(new String[] { INCLUDE_CONTEXT_PATH,
+                                                         INCLUDE_PATH_INFO,
+                                                         INCLUDE_QUERY_STRING,
+                                                         INCLUDE_REQUEST_URI,
+                                                         INCLUDE_SERVLET_PATH,
+                                                         FORWARD_CONTEXT_PATH,
+                                                         FORWARD_PATH_INFO,
+                                                         FORWARD_QUERY_STRING,
+                                                         FORWARD_REQUEST_URI,
+                                                         FORWARD_SERVLET_PATH }));
+    
     /**
      * Cache for parsed dateHeader values.
      */
@@ -114,10 +97,14 @@
     };
     
     private boolean included;
-    private boolean resetPathInfoAttributes;
     private RequestDispatcherPathInfo methodPathInfo;
     private RequestDispatcherPathInfo includedPathInfo;
     private RequestDispatcherPathInfo forwardedPathInfo;
+
+    private Map<String, String[]> parameterMap;
+    private Map<String, String[]> origParameterMap;
+    
+    private ServletRequest currentRequest;
     
     private final ServletContext servletContext;
     private final PortletRequest portletRequest;
@@ -126,9 +113,12 @@
     private final boolean renderPhase;
     private HttpSession session;
     
+    @SuppressWarnings("unchecked")
     public HttpServletPortletRequestWrapper(HttpServletRequest request, ServletContext servletContext, HttpSession session, PortletRequest portletRequest, RequestDispatcherPathInfo pathInfo, boolean included)
     {
-        super(new PortletRequestParametersWrapper(request, portletRequest));
+        super(request);
+        currentRequest = request;
+        origParameterMap = request.getParameterMap();
         this.servletContext = servletContext;
         this.session = session;
         this.portletRequest = portletRequest;
@@ -184,43 +174,6 @@
         return dateValue.longValue();
     }
     
-    private void resetPathInfoAttributes()
-    {
-        if (includedPathInfo == null || includedPathInfo.isNamedRequestDispatcher())
-        {
-            removeAttribute(INCLUDE_CONTEXT_PATH);
-            removeAttribute(INCLUDE_PATH_INFO);
-            removeAttribute(INCLUDE_QUERY_STRING);
-            removeAttribute(INCLUDE_REQUEST_URI);
-            removeAttribute(INCLUDE_SERVLET_PATH);
-        }
-        if (forwardedPathInfo == null || forwardedPathInfo.isNamedRequestDispatcher())
-        {
-            removeAttribute(FORWARD_CONTEXT_PATH);
-            removeAttribute(FORWARD_PATH_INFO);
-            removeAttribute(FORWARD_QUERY_STRING);
-            removeAttribute(FORWARD_REQUEST_URI);
-            removeAttribute(FORWARD_SERVLET_PATH);
-        }
-        if (includedPathInfo != null && !includedPathInfo.isNamedRequestDispatcher())
-        {
-            setAttribute(INCLUDE_CONTEXT_PATH, getContextPath());
-            setAttribute(INCLUDE_PATH_INFO, includedPathInfo.getPathInfo());
-            setAttribute(INCLUDE_QUERY_STRING, includedPathInfo.getQueryString());
-            setAttribute(INCLUDE_REQUEST_URI, includedPathInfo.getRequestURI());
-            setAttribute(INCLUDE_SERVLET_PATH, includedPathInfo.getServletPath());
-        }
-        if (forwardedPathInfo != null && !forwardedPathInfo.isNamedRequestDispatcher())
-        {
-            setAttribute(FORWARD_CONTEXT_PATH, getContextPath());
-            setAttribute(FORWARD_PATH_INFO, forwardedPathInfo.getPathInfo());
-            setAttribute(FORWARD_QUERY_STRING, forwardedPathInfo.getQueryString());
-            setAttribute(FORWARD_REQUEST_URI, forwardedPathInfo.getRequestURI());
-            setAttribute(FORWARD_SERVLET_PATH, forwardedPathInfo.getServletPath());
-        }
-        resetPathInfoAttributes = false;
-    }
-    
     public boolean isForwardingPossible()
     {
         return !renderPhase;
@@ -243,7 +196,6 @@
             forwardedPathInfo = attributesPathInfo;
         }
         this.included = included;
-        resetPathInfoAttributes = true;
     }
     
     public void restorePathInfo(RequestDispatcherPathInfo methodPathInfo, RequestDispatcherPathInfo includedPathInfo, RequestDispatcherPathInfo forwardedPathInfo, boolean included)
@@ -270,6 +222,87 @@
     }
     
     @Override
+    public String getParameter(String name)
+    {
+        String[] values = this.getParameterMap().get(name);
+        return values != null ? values[0] : null;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public Map<String, String[]> getParameterMap()
+    {
+        if (getRequest() != currentRequest)
+        {
+            currentRequest = getRequest();
+            Map<String, String[]> currParameterMap = currentRequest.getParameterMap();
+            Map<String, String[]> diffParameterMap = new HashMap<String, String[]>();
+            
+            for (Map.Entry<String,String[]> entry : currParameterMap.entrySet())
+            {
+                String[] values = entry.getValue();
+                String[] original = origParameterMap.get(entry.getKey());
+                String[] diff = null;
+                if ( original == null )
+                {
+                    // a new parameter
+                    diff = values.clone();
+                }
+                else if ( values.length > original.length )
+                {
+                    // we've got some additional query string parameter value(s)
+                    diff = new String[values.length - original.length];
+                    System.arraycopy(values,0,diff,0,values.length-original.length);
+                }
+                if ( diff != null )
+                {
+                    diffParameterMap.put(entry.getKey(), diff);
+                }
+            }
+            if (!diffParameterMap.isEmpty())
+            {
+                currParameterMap.clear();
+                currParameterMap.putAll(portletRequest.getParameterMap());
+                for (Map.Entry<String, String[]> entry : diffParameterMap.entrySet())
+                {
+                    String[] diff = entry.getValue();
+                    String[] curr = currParameterMap.get(entry.getKey());
+                    if ( curr == null )
+                    {
+                        currParameterMap.put(entry.getKey(), diff.clone());
+                    }
+                    else
+                    {
+                        // we've got some additional query string parameter value(s)
+                        String[] copy = new String[curr.length+diff.length];
+                        System.arraycopy(diff,0,copy,0,diff.length);
+                        System.arraycopy(curr,0,copy,diff.length,curr.length);
+                        currParameterMap.put(entry.getKey(), copy);
+                    }
+                }
+                parameterMap = Collections.unmodifiableMap(currParameterMap);
+            }
+        }
+        if (parameterMap == null)
+        {
+            parameterMap = portletRequest.getParameterMap();
+        }
+        return parameterMap;
+    }
+
+    @Override
+    public Enumeration<String> getParameterNames()
+    {
+        return Collections.enumeration(this.getParameterMap().keySet());
+    }
+
+    @Override
+    public String[] getParameterValues(String name)
+    {
+        return this.getParameterMap().get(name);
+    }
+
+    @Override
     public String getAuthType()
     {
         return portletRequest.getAuthType();
@@ -330,6 +363,12 @@
     {
         return renderPhase ? "GET" : super.getMethod();
     }
+    
+    @Override
+    public String getContextPath()
+    {
+        return portletRequest.getContextPath();
+    }
 
     @Override
     public String getPathInfo()
@@ -412,9 +451,55 @@
     @Override
     public Object getAttribute(String name)
     {
-        if (resetPathInfoAttributes)
+        if (pathInfoAttributes.contains(name))
         {
-            resetPathInfoAttributes();
+            if (includedPathInfo != null && !includedPathInfo.isNamedRequestDispatcher())
+            {
+                if (INCLUDE_CONTEXT_PATH.equals(name))
+                {
+                    return getContextPath();
+                }
+                else if (INCLUDE_PATH_INFO.equals(name))
+                {
+                    return includedPathInfo.getPathInfo();
+                }
+                else if (INCLUDE_QUERY_STRING.equals(name))
+                {
+                    return includedPathInfo.getQueryString();
+                }
+                else if (INCLUDE_REQUEST_URI.equals(name))
+                {
+                    return includedPathInfo.getRequestURI();
+                }
+                else if (INCLUDE_SERVLET_PATH.equals(name))
+                {
+                    return includedPathInfo.getServletPath();
+                }
+            }
+            if (forwardedPathInfo != null && !forwardedPathInfo.isNamedRequestDispatcher())
+            {
+                if (FORWARD_CONTEXT_PATH.equals(name))
+                {
+                    return getContextPath();
+                }
+                else if (FORWARD_PATH_INFO.equals(name))
+                {
+                    return forwardedPathInfo.getPathInfo();
+                }
+                else if (FORWARD_QUERY_STRING.equals(name))
+                {
+                    return forwardedPathInfo.getQueryString();
+                }
+                else if (FORWARD_REQUEST_URI.equals(name))
+                {
+                    return forwardedPathInfo.getRequestURI();
+                }
+                else if (FORWARD_SERVLET_PATH.equals(name))
+                {
+                    return forwardedPathInfo.getServletPath();
+                }                
+            }
+            return null;
         }
         return portletRequest.getAttribute(name);
     }
@@ -422,10 +507,6 @@
     @Override
     public Enumeration<String> getAttributeNames()
     {
-        if (resetPathInfoAttributes)
-        {
-            resetPathInfoAttributes();
-        }
         return portletRequest.getAttributeNames();
     }
 
@@ -540,8 +621,10 @@
                         // be present to build a correct RequestDispatcherPathInfo
                     }
                 }
-                PortletRequestContext requestContext = (PortletRequestContext)portletRequest.getAttribute(Constants.REQUEST_CONTEXT);
-                return new PortletRequestDispatcherImpl(dispatcher, requestContext.getPortletConfig().getPortletContext().getPathInfo(path));
+                PortletRequestContext requestContext = (PortletRequestContext)portletRequest.getAttribute(PortletInvokerService.REQUEST_CONTEXT);
+                PortletApplicationDefinition app = requestContext.getPortletWindow().getPortletEntity().getPortletDefinition().getApplication();
+                RequestDispatcherPathInfoProvider provider = RequestDispatcherPathInfoProviderImpl.getProvider(requestContext.getPortletContext(), app);
+                return new PortletRequestDispatcherImpl(dispatcher, provider.getPathInfo(getContextPath(),path));
             }
         }
         return null;

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/MimeResponseImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/MimeResponseImpl.java?rev=753592&r1=753591&r2=753592&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/MimeResponseImpl.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/MimeResponseImpl.java Sat Mar 14 03:17:03 2009
@@ -41,6 +41,8 @@
     
     private boolean usingWriter;
     private boolean usingStream;
+    private boolean committed;
+    private String contentType;
 
     private PortletMimeResponseContext responseContext;
     
@@ -89,6 +91,7 @@
     
     public void flushBuffer() throws IOException
     {
+        committed = true;
         responseContext.flushBuffer();
     }
 
@@ -108,7 +111,7 @@
 
     public String getContentType()
     {
-        return responseContext.getContentType();
+        return contentType;
     }
     
     public Locale getLocale()
@@ -148,26 +151,39 @@
 
     public boolean isCommitted()
     {
-        return responseContext.isCommitted();
+        return committed ? true : responseContext.isCommitted();
     }
 
     public void reset()
     {
+        if (isCommitted())
+        {
+            throw new IllegalStateException("Response is already committed");
+        }
         responseContext.reset();
     }
 
     public void resetBuffer()
     {
+        if (isCommitted())
+        {
+            throw new IllegalStateException("Response is already committed");
+        }
         responseContext.resetBuffer();
     }
 
     public void setBufferSize(int size)
     {
+        if (isCommitted())
+        {
+            throw new IllegalStateException("Response is already committed");
+        }
         responseContext.setBufferSize(size);
     }
     
     public void setContentType(String contentType)
     {
+        this.contentType = contentType;
         responseContext.setContentType(contentType);
     }
     

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletAppDescriptorServiceImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletAppDescriptorServiceImpl.java?rev=753592&r1=753591&r2=753592&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletAppDescriptorServiceImpl.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletAppDescriptorServiceImpl.java Sat Mar 14 03:17:03 2009
@@ -126,7 +126,7 @@
      */
     
     @SuppressWarnings("unchecked")
-    public PortletApplicationDefinition read(InputStream in) throws IOException {
+    public PortletApplicationDefinition read(String name, String contextPath, InputStream in) throws IOException {
         JAXBElement app = null;
         try {
             JAXBContext jc = JAXBContext.newInstance( 
@@ -144,11 +144,18 @@
         catch(Exception me) {
             throw new IOException(me.getLocalizedMessage());
         }
+        PortletApplicationDefinition pad = null;
         if (app.getValue() instanceof org.apache.pluto.container.om.portlet10.impl.PortletAppType)
         {
-            return ((org.apache.pluto.container.om.portlet10.impl.PortletAppType)app.getValue()).upgrade();
-        }       
-        return (PortletApplicationDefinition)app.getValue();
+             pad = ((org.apache.pluto.container.om.portlet10.impl.PortletAppType)app.getValue()).upgrade();
+        }      
+        else
+        {
+            pad = (PortletApplicationDefinition)app.getValue();
+        }
+        pad.setName(name);
+        pad.setContextPath(contextPath);
+        return pad;
     }
 
     public void mergeWebDescriptor(PortletApplicationDefinition pa, InputStream webDescriptor) throws Exception

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletContainerImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletContainerImpl.java?rev=753592&r1=753591&r2=753592&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletContainerImpl.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletContainerImpl.java Sat Mar 14 03:17:03 2009
@@ -35,7 +35,6 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.pluto.container.Constants;
 import org.apache.pluto.container.FilterManager;
 import org.apache.pluto.container.OptionalContainerServices;
 import org.apache.pluto.container.PortletActionResponseContext;
@@ -158,7 +157,7 @@
 
         PortletRequestContext requestContext = rcService.getPortletRenderRequestContext(this, request, response, portletWindow);
         PortletRenderResponseContext responseContext = rcService.getPortletRenderResponseContext(this, request, response, portletWindow);
-        RenderRequest portletRequest = envService.createRenderRequest(requestContext, responseContext.getCacheControl());
+        RenderRequest portletRequest = envService.createRenderRequest(requestContext, responseContext);
         RenderResponse portletResponse = envService.createRenderResponse(responseContext);
 
         FilterManager filterManager = filterInitialisation(portletWindow,PortletRequest.RENDER_PHASE);
@@ -204,7 +203,7 @@
 
         PortletResourceRequestContext requestContext = rcService.getPortletResourceRequestContext(this, request, response, portletWindow);
         PortletResourceResponseContext responseContext = rcService.getPortletResourceResponseContext(this, request, response, portletWindow);
-        ResourceRequest portletRequest = envService.createResourceRequest(requestContext, responseContext.getCacheControl());
+        ResourceRequest portletRequest = envService.createResourceRequest(requestContext, responseContext);
         ResourceResponse portletResponse = envService.createResourceResponse(responseContext, requestContext.getCacheability());
 
         FilterManager filterManager = filterInitialisation(portletWindow,PortletRequest.RESOURCE_PHASE);
@@ -250,7 +249,7 @@
 
         PortletRequestContext requestContext = rcService.getPortletActionRequestContext(this, request, response, portletWindow);
         PortletActionResponseContext responseContext = rcService.getPortletActionResponseContext(this, request, response, portletWindow);
-        ActionRequest portletRequest = envService.createActionRequest(requestContext);
+        ActionRequest portletRequest = envService.createActionRequest(requestContext, responseContext);
         ActionResponse portletResponse = envService.createActionResponse(responseContext);
 
         FilterManager filterManager = filterInitialisation(portletWindow,PortletRequest.ACTION_PHASE);
@@ -322,7 +321,7 @@
 
         PortletRequestContext requestContext = rcService.getPortletRenderRequestContext(this, request, response, portletWindow);
         PortletRenderResponseContext responseContext = rcService.getPortletRenderResponseContext(this, request, response, portletWindow);
-        RenderRequest portletRequest = envService.createRenderRequest(requestContext, responseContext.getCacheControl());
+        RenderRequest portletRequest = envService.createRenderRequest(requestContext, responseContext);
         RenderResponse portletResponse = envService.createRenderResponse(responseContext);
 
         try
@@ -356,7 +355,7 @@
 
         PortletRequestContext requestContext = rcService.getPortletRenderRequestContext(this, request, response, portletWindow);
         PortletRenderResponseContext responseContext = rcService.getPortletRenderResponseContext(this, request, response, portletWindow);
-        RenderRequest portletRequest = envService.createRenderRequest(requestContext, responseContext.getCacheControl());
+        RenderRequest portletRequest = envService.createRenderRequest(requestContext, responseContext);
         RenderResponse portletResponse = envService.createRenderResponse(responseContext);
 
         try
@@ -422,7 +421,7 @@
 
         PortletRequestContext requestContext = rcService.getPortletEventRequestContext(this, request, response, portletWindow);
         PortletEventResponseContext responseContext = rcService.getPortletEventResponseContext(this, request, response, portletWindow);
-        EventRequest portletRequest = envService.createEventRequest(requestContext, event);
+        EventRequest portletRequest = envService.createEventRequest(requestContext, responseContext, event);
         EventResponse portletResponse = envService.createEventResponse(responseContext);
 
         FilterManager filterManager = filterInitialisation(portletWindow,PortletRequest.EVENT_PHASE);
@@ -486,24 +485,6 @@
     }
     
 	/**
-	 * Checks if render parameter are already cleared,
-	 * bye storing/reading an ID in the request
-	 * 
-	 * @param request the portlet request
-	 * 
-	 * @return true, if already cleared
-	 */
-	protected boolean isAlreadyCleared(PortletRequest request) 
-	{
-		String cleared = (String) request.getAttribute(Constants.RENDER_ALREADY_CLEARED);
-		if (cleared == null || cleared.equals("false")) {
-			request.setAttribute(Constants.RENDER_ALREADY_CLEARED,"true");
-			return false;
-		}
-		return true;
-	}    
-	
-	/**
 	 * The method initialise the FilterManager for later use in the PortletServlet
 	 * @param PortletWindow the PortletWindow
 	 * @param lifeCycle like ACTION_PHASE, RENDER_PHASE,...

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletEnvironmentServiceImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletEnvironmentServiceImpl.java?rev=753592&r1=753591&r2=753592&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletEnvironmentServiceImpl.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletEnvironmentServiceImpl.java Sat Mar 14 03:17:03 2009
@@ -19,7 +19,6 @@
 
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
-import javax.portlet.CacheControl;
 import javax.portlet.Event;
 import javax.portlet.EventRequest;
 import javax.portlet.EventResponse;
@@ -42,9 +41,9 @@
 
 public class PortletEnvironmentServiceImpl implements PortletEnvironmentService
 {
-    public ActionRequest createActionRequest(PortletRequestContext requestContext)
+    public ActionRequest createActionRequest(PortletRequestContext requestContext, PortletActionResponseContext responseContext)
     {
-        return new ActionRequestImpl(requestContext);
+        return new ActionRequestImpl(requestContext, responseContext);
     }
 
     public ActionResponse createActionResponse(PortletActionResponseContext responseContext)
@@ -52,9 +51,9 @@
         return new ActionResponseImpl(responseContext);
     }
 
-    public EventRequest createEventRequest(PortletRequestContext requestContext, Event event)
+    public EventRequest createEventRequest(PortletRequestContext requestContext, PortletEventResponseContext responseContext, Event event)
     {
-        return new EventRequestImpl(requestContext, event);
+        return new EventRequestImpl(requestContext, responseContext, event);
     }
 
     public EventResponse createEventResponse(PortletEventResponseContext responseContext)
@@ -68,9 +67,9 @@
         return new PortletSessionImpl(portletContext, portletWindow, session);
     }
 
-    public RenderRequest createRenderRequest(PortletRequestContext requestContext, CacheControl cacheControl)
+    public RenderRequest createRenderRequest(PortletRequestContext requestContext, PortletRenderResponseContext responseContext)
     {
-        return new RenderRequestImpl(requestContext, cacheControl);
+        return new RenderRequestImpl(requestContext, responseContext);
     }
 
     public RenderResponse createRenderResponse(PortletRenderResponseContext responseContext)
@@ -78,9 +77,9 @@
         return new RenderResponseImpl(responseContext);
     }
 
-    public ResourceRequest createResourceRequest(PortletResourceRequestContext requestContext, CacheControl cacheControl)
+    public ResourceRequest createResourceRequest(PortletResourceRequestContext requestContext, PortletResourceResponseContext responseContext)
     {
-        return new ResourceRequestImpl(requestContext, cacheControl);
+        return new ResourceRequestImpl(requestContext, responseContext);
     }
 
     public ResourceResponse createResourceResponse(PortletResourceResponseContext responseContext,

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestDispatcherImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestDispatcherImpl.java?rev=753592&r1=753591&r2=753592&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestDispatcherImpl.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestDispatcherImpl.java Sat Mar 14 03:17:03 2009
@@ -34,7 +34,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.pluto.container.Constants;
+import org.apache.pluto.container.PortletInvokerService;
 import org.apache.pluto.container.PortletRequestContext;
 import org.apache.pluto.container.RequestDispatcherPathInfo;
 
@@ -60,20 +60,6 @@
     
     /**
      * Creates an instance. This constructor should be called to construct a
-     * named dispatcher.
-     * @param requestDispatcher  the servlet request dispatcher.
-     * @see javax.portlet.PortletContext#getNamedDispatcher(String)
-     */
-    public PortletRequestDispatcherImpl(RequestDispatcher requestDispatcher) {
-        this.requestDispatcher = requestDispatcher;
-        if (LOG.isDebugEnabled())
-        {
-        	LOG.debug("Named dispatcher created.");
-        }
-    }
-    
-    /**
-     * Creates an instance. This constructor should be called to construct a
      * portlet request dispatcher.
      * @param requestDispatcher  the servlet request dispatcher.
      * @param pathInfo 
@@ -138,18 +124,20 @@
     
     private void doDispatch(PortletRequest request, PortletResponse response, boolean included) throws PortletException, IOException
     {
+        boolean needsFlushAfterForward = false;
         if (!included)
         {
             String lifecyclePhase = (String)request.getAttribute(PortletRequest.LIFECYCLE_PHASE);
             if (PortletRequest.RENDER_PHASE.equals(lifecyclePhase) || PortletRequest.RESOURCE_PHASE.equals(lifecyclePhase))
             {
+                needsFlushAfterForward = true;
                 ((MimeResponse)response).resetBuffer();
             }
         }
         
-        PortletRequestContext requestContext = (PortletRequestContext)request.getAttribute(Constants.REQUEST_CONTEXT);
+        PortletRequestContext requestContext = (PortletRequestContext)request.getAttribute(PortletInvokerService.REQUEST_CONTEXT);
         HttpServletPortletRequestWrapper req = new HttpServletPortletRequestWrapper(requestContext.getServletRequest(), 
-                                                                                    requestContext.getPortletConfig().getPortletContext().getServletContext(),
+                                                                                    requestContext.getServletContext(),
                                                                                     null, // TODO: ProxySession if javax.portlet.servletDefaultSessionScope == PORTLET_SCOPE
                                                                                     request,
                                                                                     pathInfo,
@@ -168,6 +156,10 @@
             {
                 requestDispatcher.include(req, res);
             }
+            if (needsFlushAfterForward)
+            {
+                ((MimeResponse)response).flushBuffer();
+            }
         }
         catch (ServletException sex)
         {

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestImpl.java?rev=753592&r1=753591&r2=753592&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestImpl.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestImpl.java Sat Mar 14 03:17:03 2009
@@ -30,6 +30,7 @@
 import javax.portlet.CacheControl;
 import javax.portlet.MimeResponse;
 import javax.portlet.PortalContext;
+import javax.portlet.PortletContext;
 import javax.portlet.PortletMode;
 import javax.portlet.PortletPreferences;
 import javax.portlet.PortletRequest;
@@ -41,13 +42,13 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.pluto.container.Constants;
-import org.apache.pluto.container.ContainerPortletContext;
 import org.apache.pluto.container.OptionalContainerServices;
 import org.apache.pluto.container.PortletContainer;
 import org.apache.pluto.container.PortletEntity;
 import org.apache.pluto.container.PortletEnvironmentService;
+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;
 import org.apache.pluto.container.om.portlet.SecurityRoleRef;
@@ -78,6 +79,7 @@
     private PortalContext portalContext;
     
     private PortletRequestContext requestContext;
+    private PortletResponseContext responseContext;
     
     /** The portlet session. */
     private PortletSession portletSession;
@@ -100,10 +102,14 @@
     
     private final String lifecyclePhase;
     
-    public PortletRequestImpl(PortletRequestContext requestContext, String lifecyclePhase) 
+    private final String contextPath;
+    
+    public PortletRequestImpl(PortletRequestContext requestContext, PortletResponseContext responseContext, String lifecyclePhase) 
     {
         this.requestContext = requestContext;
+        this.responseContext = responseContext;
         this.lifecyclePhase = lifecyclePhase;
+        this.contextPath = requestContext.getPortletWindow().getPortletEntity().getPortletDefinition().getApplication().getContextPath();
         this.portalContext = getPortletContainer().getRequiredContainerServices().getPortalContext();
     }
     
@@ -215,9 +221,9 @@
         return requestContext;
     }
 
-    protected ContainerPortletContext getPortletContext()
+    protected PortletContext getPortletContext()
     {
-        return requestContext.getPortletConfig().getPortletContext();
+        return requestContext.getPortletContext();
     }
     
     protected PortletWindow getPortletWindow() 
@@ -253,7 +259,7 @@
         {
             return Integer.toString(cacheControl.getExpirationTime());
         }
-        return getProperty(name);
+        return null;
     }
     
     // PortletRequest Impl -----------------------------------------------------
@@ -280,10 +286,14 @@
             }
             return userInfo;
         }
-        else if (name.equals(Constants.REQUEST_CONTEXT))
+        else if (name.equals(PortletInvokerService.REQUEST_CONTEXT))
         {
             return requestContext;
         }
+        else if (name.equals(PortletInvokerService.RESPONSE_CONTEXT))
+        {
+            return responseContext;
+        }
         else if (name.equals(PortletRequest.CCPP_PROFILE))
         {
             if (ccppProfile == null)
@@ -307,7 +317,7 @@
 
     public String getContextPath() 
     {
-        return getPortletContext().getContextPath();
+        return contextPath;
     }
 
     public Cookie[] getCookies()

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletURLImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletURLImpl.java?rev=753592&r1=753591&r2=753592&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletURLImpl.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletURLImpl.java Sat Mar 14 03:17:03 2009
@@ -37,6 +37,7 @@
 import javax.portlet.WindowStateException;
 
 import org.apache.pluto.container.PortletMimeResponseContext;
+import org.apache.pluto.container.PortletResponseContext;
 import org.apache.pluto.container.PortletURLListenerService;
 import org.apache.pluto.container.PortletURLProvider;
 import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;
@@ -51,19 +52,24 @@
  */
 public class PortletURLImpl implements PortletURL, ResourceURL {
 
-    private PortletMimeResponseContext responseContext;
+    private PortletResponseContext responseContext;
     private PortalContext portalContext;
     private PortletURLProvider urlProvider;
     private String cacheLevel = ResourceURL.PAGE;
     private boolean filtering;
     private boolean renderURL;
     
-    public PortletURLImpl(PortletMimeResponseContext responseContext, PortletURLProvider.TYPE type)
+    public PortletURLImpl(PortletResponseContext responseContext, PortletURLProvider urlProvider)
     {
         this.responseContext = responseContext;
         this.portalContext = responseContext.getContainer().getRequiredContainerServices().getPortalContext();
-        urlProvider = responseContext.getPortletURLProvider(type);
-        renderURL = PortletURLProvider.TYPE.RENDER == type;
+        this.urlProvider = urlProvider;
+        renderURL = PortletURLProvider.TYPE.RENDER == urlProvider.getType();
+    }
+    
+    public PortletURLImpl(PortletMimeResponseContext responseContext, PortletURLProvider.TYPE type)
+    {
+        this(responseContext, responseContext.getPortletURLProvider(type));
     }
     
     public PortletURLImpl(PortletMimeResponseContext responseContext, String cacheLevel)
@@ -168,7 +174,7 @@
         }
     }
     
-    private void filterURL()
+    public void filterURL()
     {
         if (filtering)
         {
@@ -359,8 +365,7 @@
 
     public void write(Writer out) throws IOException
     {
-        filterURL();
-        urlProvider.write(out);
+        write(out, true);
     }
     
     public String toString()

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/RenderRequestImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/RenderRequestImpl.java?rev=753592&r1=753591&r2=753592&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/RenderRequestImpl.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/RenderRequestImpl.java Sat Mar 14 03:17:03 2009
@@ -20,6 +20,7 @@
 import javax.portlet.PortletRequest;
 import javax.portlet.RenderRequest;
 
+import org.apache.pluto.container.PortletRenderResponseContext;
 import org.apache.pluto.container.PortletRequestContext;
 
 /**
@@ -30,17 +31,18 @@
 {
     private CacheControl cacheControl;
     
-    public RenderRequestImpl(PortletRequestContext requestContext, CacheControl cacheControl) 
+    public RenderRequestImpl(PortletRequestContext requestContext, PortletRenderResponseContext responseContext) 
     {
-        super(requestContext, PortletRequest.RENDER_PHASE);
-        this.cacheControl = cacheControl;
+        super(requestContext, responseContext, PortletRequest.RENDER_PHASE);
+        this.cacheControl = responseContext.getCacheControl();
     }
 
     @Override
     public String getProperty(String name)
     {
-        return getMimeRequestProperty(name, cacheControl);
-    }
+        String result = getMimeRequestProperty(name, cacheControl);
+        return result != null ? result : super.getProperty(name);
+   }
 
     public String getETag()
     {

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/RenderResponseImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/RenderResponseImpl.java?rev=753592&r1=753591&r2=753592&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/RenderResponseImpl.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/RenderResponseImpl.java Sat Mar 14 03:17:03 2009
@@ -80,6 +80,7 @@
         return valid;
     }
     
+    @Override
     public void setContentType(String contentType)
     {
         ArgumentUtility.validateNotNull("contentType", contentType);
@@ -93,7 +94,7 @@
         {
             throw new IllegalArgumentException("Specified content type '" + contentType + "' is not supported.");
         }
-        responseContext.setContentType(contentType);
+        super.setContentType(contentType);
     }
     
     public void setNextPossiblePortletModes(Collection<PortletMode> portletModes)

Added: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/RequestDispatcherPathInfoProviderImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/RequestDispatcherPathInfoProviderImpl.java?rev=753592&view=auto
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/RequestDispatcherPathInfoProviderImpl.java (added)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/RequestDispatcherPathInfoProviderImpl.java Sat Mar 14 03:17:03 2009
@@ -0,0 +1,144 @@
+/*
+ * 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.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import javax.portlet.PortletContext;
+
+import org.apache.pluto.container.RequestDispatcherPathInfo;
+import org.apache.pluto.container.RequestDispatcherPathInfoProvider;
+import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;
+
+/**
+ * @version $Id$
+ *
+ */
+public class RequestDispatcherPathInfoProviderImpl implements RequestDispatcherPathInfoProvider
+{
+    protected List<String> exactServletMappingURLPatterns = new ArrayList<String>();
+    protected List<String> pathServletMappingURLPatterns = new ArrayList<String>();
+    protected List<String> extServletMappingURLPatterns = new ArrayList<String>();
+    protected boolean defaultServletMapping = false;
+    
+    private RequestDispatcherPathInfoProviderImpl(Set<String> servletMappingURLPatterns)
+    {
+        for (String pat : servletMappingURLPatterns)
+        {                 
+            if (pat.startsWith("/"))
+            {
+                if (pat.equals("/") || pat.equals("/*"))
+                {
+                    defaultServletMapping = true;
+                }
+                else if (pat.endsWith("/*"))
+                {
+                    pathServletMappingURLPatterns.add(pat.substring(0,pat.length()-2));
+                }
+                else
+                {
+                    exactServletMappingURLPatterns.add(pat);
+                }
+            }
+            else if (pat.startsWith("*."))
+            {
+                extServletMappingURLPatterns.add(pat.substring(1));
+            }
+            else
+            {
+                exactServletMappingURLPatterns.add(pat);
+            }
+        }
+    }
+    
+    public static RequestDispatcherPathInfoProvider getProvider(PortletContext portletContext, PortletApplicationDefinition app)
+    {
+        RequestDispatcherPathInfoProvider provider = (RequestDispatcherPathInfoProvider)portletContext.getAttribute(CONTEXT_KEY);
+        if (provider == null)
+        {
+            provider = new RequestDispatcherPathInfoProviderImpl(app.getServletMappingURLPatterns());
+            portletContext.setAttribute(CONTEXT_KEY, provider);
+        }
+        return provider;
+    }
+    
+    public RequestDispatcherPathInfo getNamedRequestDispatcherPathInfo()
+    {
+        return new RequestDispatcherPathInfoImpl();
+    }
+
+    public RequestDispatcherPathInfo getPathInfo(String contextPath, String path)
+    {
+        String servletPath = null;
+        String pathInfo = null;
+        String queryString = null;
+        
+        int index = path.indexOf('?');
+        if (index != -1)
+        {
+            queryString = path.substring(index+1, path.length());
+            path = path.substring(0, index);
+        }
+        
+        if (exactServletMappingURLPatterns.contains(path))
+        {
+            servletPath = path;
+        }
+        else if (path.length() == 1 && defaultServletMapping)
+        {
+            servletPath = path;
+        }
+        else
+        {
+            String sub = path;
+            index = path.lastIndexOf('/');
+            while (index > 0)
+            {
+                sub = sub.substring(0, index);
+                if (pathServletMappingURLPatterns.contains(sub))
+                {
+                    servletPath = sub;
+                    if (sub.length() < path.length())
+                    {
+                        pathInfo = path.substring(sub.length());
+                    }
+                    break;
+                }
+                index = sub.lastIndexOf('/');
+            }
+        }
+        if (servletPath == null)
+        {
+            index = path.lastIndexOf('/');
+            int ext = path.indexOf('.', index);
+            if (ext != -1 && ext < path.length()-1 && extServletMappingURLPatterns.contains(path.substring(ext)))
+            {
+                servletPath = index > 0 ? path.substring(0, index) : "";
+                pathInfo = path.substring(index);
+            }
+        }
+        if (servletPath == null)
+        {
+            servletPath = path;            
+        }
+        
+        return new RequestDispatcherPathInfoImpl(contextPath,servletPath,pathInfo,queryString);
+    }
+}

Propchange: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/RequestDispatcherPathInfoProviderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/RequestDispatcherPathInfoProviderImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/RequestDispatcherPathInfoProviderImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/ResourceRequestImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/ResourceRequestImpl.java?rev=753592&r1=753591&r2=753592&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/ResourceRequestImpl.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/ResourceRequestImpl.java Sat Mar 14 03:17:03 2009
@@ -24,23 +24,25 @@
 import javax.portlet.ResourceRequest;
 
 import org.apache.pluto.container.PortletResourceRequestContext;
+import org.apache.pluto.container.PortletResourceResponseContext;
 
 public class ResourceRequestImpl extends ClientDataRequestImpl implements ResourceRequest
 {
     private PortletResourceRequestContext requestContext;
     private CacheControl cacheControl;
     
-    public ResourceRequestImpl(PortletResourceRequestContext requestContext, CacheControl cacheControl)
+    public ResourceRequestImpl(PortletResourceRequestContext requestContext, PortletResourceResponseContext responseContext)
     {
-        super(requestContext, PortletRequest.RESOURCE_PHASE);
+        super(requestContext, responseContext, PortletRequest.RESOURCE_PHASE);
         this.requestContext = requestContext;
-        this.cacheControl = cacheControl;
+        this.cacheControl = responseContext.getCacheControl();
     }
-
+    
     @Override
     public String getProperty(String name)
     {
-        return getMimeRequestProperty(name, cacheControl);
+        String result = getMimeRequestProperty(name, cacheControl);
+        return result != null ? result : super.getProperty(name);
     }
 
     public String getCacheability()

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/ResourceResponseImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/ResourceResponseImpl.java?rev=753592&r1=753591&r2=753592&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/ResourceResponseImpl.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/ResourceResponseImpl.java Sat Mar 14 03:17:03 2009
@@ -30,11 +30,11 @@
     private String requestCacheLevel;
     private PortletResourceResponseContext responseContext;
     
-    public ResourceResponseImpl(PortletResourceResponseContext responseContext, String requestCachelevel)
+    public ResourceResponseImpl(PortletResourceResponseContext responseContext, String requestCacheLevel)
     {
         super(responseContext);
         this.responseContext = responseContext;
-        this.requestCacheLevel = requestCachelevel == null ? ResourceURL.PAGE : requestCacheLevel;
+        this.requestCacheLevel = requestCacheLevel == null ? ResourceURL.PAGE : requestCacheLevel;
     }
 	
     public PortletURL createActionURL()

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/StateAwareResponseImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/StateAwareResponseImpl.java?rev=753592&r1=753591&r2=753592&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/StateAwareResponseImpl.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/StateAwareResponseImpl.java Sat Mar 14 03:17:03 2009
@@ -23,6 +23,7 @@
 import java.util.List;
 import java.util.Map;
 
+import javax.portlet.Event;
 import javax.portlet.PortletMode;
 import javax.portlet.PortletModeException;
 import javax.portlet.StateAwareResponse;
@@ -136,7 +137,11 @@
 	public void setEvent(QName qname, Serializable value)
 	{
         ArgumentUtility.validateNotNull("qname", qname);
-		responseContext.getEvents().add(responseContext.getEventProvider().createEvent(qname, value));
+        Event event = responseContext.getEventProvider().createEvent(qname, value);
+        if (event != null)
+        {
+            responseContext.getEvents().add(event);
+        }
 	}
 
 	public void setEvent(String name, Serializable value)

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletAppType.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletAppType.java?rev=753592&r1=753591&r2=753592&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletAppType.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletAppType.java Sat Mar 14 03:17:03 2009
@@ -124,6 +124,8 @@
     @XmlTransient
     protected String name;
     @XmlTransient
+    protected String contextPath;
+    @XmlTransient
     protected Set<String> servletMappingURLPatterns;
     @XmlTransient
     protected Map<Locale, String> localeEncodingMappings;
@@ -138,6 +140,16 @@
         this.name = name;
     }
     
+    public String getContextPath()
+    {
+        return contextPath;
+    }
+    
+    public void setContextPath(String contextPath)
+    {
+        this.contextPath = contextPath;
+    }
+    
     public PortletDefinition getPortlet(String portletName)
     {
         for (PortletDefinition pd : getPortlets())

Modified: portals/pluto/trunk/pluto-container/src/main/resources/org/apache/pluto/container/driver/impl/pluto-configuration.properties
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/resources/org/apache/pluto/container/driver/impl/pluto-configuration.properties?rev=753592&r1=753591&r2=753592&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/resources/org/apache/pluto/container/driver/impl/pluto-configuration.properties (original)
+++ portals/pluto/trunk/pluto-container/src/main/resources/org/apache/pluto/container/driver/impl/pluto-configuration.properties Sat Mar 14 03:17:03 2009
@@ -24,5 +24,5 @@
 javax.portlet.version.major=${javax.portlet.version.major}
 javax.portlet.version.minor=${javax.portlet.version.minor}
 
-org.apache.pluto.descriptors.services.PortletAppDescriptorService=org.apache.pluto.descriptors.services.jaxb.PortletAppDescriptorServiceImpl
+org.apache.pluto.descriptors.services.PortletAppDescriptorService=org.apache.pluto.container.impl.PortletAppDescriptorServiceImpl
 org.apache.pluto.container.supportedContainerRuntimeOptions=test,escapeXML,value

Modified: portals/pluto/trunk/pluto-container/src/test/java/org/apache/pluto/container/impl/JaxBDescriptorServiceImplTest.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/test/java/org/apache/pluto/container/impl/JaxBDescriptorServiceImplTest.java?rev=753592&r1=753591&r2=753592&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/test/java/org/apache/pluto/container/impl/JaxBDescriptorServiceImplTest.java (original)
+++ portals/pluto/trunk/pluto-container/src/test/java/org/apache/pluto/container/impl/JaxBDescriptorServiceImplTest.java Sat Mar 14 03:17:03 2009
@@ -309,10 +309,10 @@
 			
 	        InputStream in = new ByteArrayInputStream(xml286.toString().getBytes());
 	        
-			PortletApplicationDefinition portletApp286 = jaxb.read(in);
+			PortletApplicationDefinition portletApp286 = jaxb.read("test", "/test", in);
 			
 			in = new ByteArrayInputStream(xml168.toString().getBytes());
-			PortletApplicationDefinition portletApp168 = jaxb.read(in);
+			PortletApplicationDefinition portletApp168 = jaxb.read("test", "/test", in);
 			
 			// test if portlet has the right params:
 			
@@ -384,7 +384,7 @@
 	
 	public void testReadNullDescriptor() {
 		try {
-			Assert.assertNull("Null descriptor did not return null", jaxb.read(null));
+			Assert.assertNull("Null descriptor did not return null", jaxb.read("test", "/test", null));
 			fail("exception should be thrown");
 		} catch (IOException ioe){
 			
@@ -393,7 +393,7 @@
 
     public void testParseNoExpirationCache168() throws IOException {
         InputStream inputStream = new ByteArrayInputStream(portlet168NoCache.toString().getBytes());
-        PortletApplicationDefinition portletDD = jaxb.read( inputStream );
+        PortletApplicationDefinition portletDD = jaxb.read( "test", "/test", inputStream );
 
         assertEquals( "1.0", portletDD.getVersion() );
         assertEquals( 1, portletDD.getPortlets().size() );
@@ -404,7 +404,7 @@
 
     public void testParseNoExpirationCache286() throws IOException {
         InputStream inputStream = new ByteArrayInputStream(portlet286NoCache.toString().getBytes());
-        PortletApplicationDefinition portletDD = jaxb.read( inputStream );
+        PortletApplicationDefinition portletDD = jaxb.read( "test", "/test", inputStream );
 
         assertEquals( "2.0", portletDD.getVersion() );
         assertEquals( 1, portletDD.getPortlets().size() );

Modified: portals/pluto/trunk/pluto-container/src/test/java/org/apache/pluto/container/impl/PortletRequestImplTest.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/test/java/org/apache/pluto/container/impl/PortletRequestImplTest.java?rev=753592&r1=753591&r2=753592&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/test/java/org/apache/pluto/container/impl/PortletRequestImplTest.java (original)
+++ portals/pluto/trunk/pluto-container/src/test/java/org/apache/pluto/container/impl/PortletRequestImplTest.java Sat Mar 14 03:17:03 2009
@@ -18,15 +18,15 @@
 
 import javax.portlet.CacheControl;
 import javax.portlet.PortalContext;
+import javax.portlet.PortletContext;
 import javax.portlet.PortletSession;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
 
 import org.apache.pluto.container.CCPPProfileService;
-import org.apache.pluto.container.ContainerPortletContext;
 import org.apache.pluto.container.OptionalContainerServices;
-import org.apache.pluto.container.PortletContainer;
 import org.apache.pluto.container.PortletEnvironmentService;
+import org.apache.pluto.container.PortletRenderResponseContext;
 import org.apache.pluto.container.PortletRequestContext;
 import org.apache.pluto.container.PortletURLProvider;
 import org.apache.pluto.container.PortletWindow;
@@ -55,6 +55,7 @@
     private Mock mockHttpServletRequest = null;
     private Mock mockPortletURLProvider = null;
     private Mock mockPortletRequestContext = null;
+    private Mock mockPortletResponseContext = null;
     private Mock mockCacheControl = null;
     private PortletWindow window = null;
     
@@ -71,7 +72,7 @@
         mockCCPPProfileService = mock( CCPPProfileService.class );
         mockOptionalServices = mock( OptionalContainerServices.class );
         mockPortalContext = mock( PortalContext.class );
-        mockPortletContext = mock( ContainerPortletContext.class );
+        mockPortletContext = mock( PortletContext.class );
         mockPortletURLProvider = mock(PortletURLProvider.class);
         mockContainer = mock( PortletContainerImpl.class,
                 new Class[] { String.class, RequiredContainerServices.class, OptionalContainerServices.class },
@@ -79,6 +80,7 @@
         window = (PortletWindow) mock( PortletWindow.class ).proxy();
         mockHttpServletRequest = mock( HttpServletRequest.class );
         mockPortletRequestContext = mock ( PortletRequestContext.class );
+        mockPortletResponseContext = mock ( PortletRenderResponseContext.class );
         mockCacheControl = mock ( CacheControl.class );
 
         // Constructor expectations for RenderRequestImpl
@@ -116,7 +118,7 @@
         mockPortletRequestContext.expects(atLeastOnce()).method("getContainer").will(returnValue( mockContainer.proxy()));
         
         // Create the render request that is under test, and initialize its state
-        RenderRequestImpl request = new RenderRequestImpl( (PortletRequestContext)mockPortletRequestContext.proxy(), (CacheControl)mockCacheControl.proxy() );
+        RenderRequestImpl request = new RenderRequestImpl( (PortletRequestContext)mockPortletRequestContext.proxy(), (PortletRenderResponseContext)mockPortletResponseContext.proxy() );
 
         // Mock the HttpSession, and set its expectations: it will return 0 for the last accessed time, and 5
         // for the maximum inactive interval