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 2010/05/28 12:24:49 UTC
svn commit: r949141 - in /portals/pluto:
branches/pluto-2.0.x/pluto-container/src/main/java/org/apache/pluto/container/impl/
trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/
Author: ate
Date: Fri May 28 10:24:49 2010
New Revision: 949141
URL: http://svn.apache.org/viewvc?rev=949141&view=rev
Log:
Fix for PLUTO-590: Nested dispatching from a portlet to two or more servlet/jsps does not retain the portlet contextPath when calling (servlet)request.getContextPath() but returns the portal contextPath
See: https://issues.apache.org/jira/browse/PLUTO-590
Modified:
portals/pluto/branches/pluto-2.0.x/pluto-container/src/main/java/org/apache/pluto/container/impl/HttpServletPortletRequestWrapper.java
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/HttpServletPortletRequestWrapper.java
Modified: portals/pluto/branches/pluto-2.0.x/pluto-container/src/main/java/org/apache/pluto/container/impl/HttpServletPortletRequestWrapper.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/pluto-2.0.x/pluto-container/src/main/java/org/apache/pluto/container/impl/HttpServletPortletRequestWrapper.java?rev=949141&r1=949140&r2=949141&view=diff
==============================================================================
--- portals/pluto/branches/pluto-2.0.x/pluto-container/src/main/java/org/apache/pluto/container/impl/HttpServletPortletRequestWrapper.java (original)
+++ portals/pluto/branches/pluto-2.0.x/pluto-container/src/main/java/org/apache/pluto/container/impl/HttpServletPortletRequestWrapper.java Fri May 28 10:24:49 2010
@@ -729,8 +729,11 @@ public class HttpServletPortletRequestWr
/**
* Deriving the path state values as should be provided to the invoking servlet for a nested dispatch.
* <p>
- * As we are not in "control" here anymore, assume path method values and path INCLUDE attribute values
- * as provided by the web container to be correct.
+ * We are not properly in "control" here anymore but can only assume the nested dispatch is still within
+ * the current portlet application and therefore need to reset to the initial path method values during includes.
+ * </p>
+ * <p>
+ * Furthermore, we assume at least the path INCLUDE attribute values as/if provided by the web container to be correct.
* </p>
* <p>
* However we need to retain the initial dispatch forward path attribute values <em>if</em> no new values are provided.
@@ -738,10 +741,23 @@ public class HttpServletPortletRequestWr
*/
protected void setupNestedDispatchPathValues()
{
- // Use the web container provided path values instead of the initial dispatch path values
- // whatever the current path method values: assume them correct
- pathMethodValues.copy(currPathMethodValues);
-
+ if (namedDispatch)
+ {
+ // only can/must support request.getContextPath()
+ pathMethodValues.contextPath = dispPathMethodValues.contextPath;
+ }
+ else
+ {
+ if (!forwarded || !isForwardingPossible())
+ {
+ pathMethodValues.copy(initPathMethodValues);
+ }
+ else // forwarded && isForwardingPossible()
+ {
+ pathMethodValues.copy(dispPathMethodValues);
+ }
+ }
+
// whatever the current attribute include path values: assume them correct (even if null)
pathAttributeValues.put(INCLUDE_CONTEXT_PATH, currPathAttributeValues.get(INCLUDE_CONTEXT_PATH));
pathAttributeValues.put(INCLUDE_SERVLET_PATH, currPathAttributeValues.get(INCLUDE_SERVLET_PATH));
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=949141&r1=949140&r2=949141&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 Fri May 28 10:24:49 2010
@@ -729,8 +729,11 @@ public class HttpServletPortletRequestWr
/**
* Deriving the path state values as should be provided to the invoking servlet for a nested dispatch.
* <p>
- * As we are not in "control" here anymore, assume path method values and path INCLUDE attribute values
- * as provided by the web container to be correct.
+ * We are not properly in "control" here anymore but can only assume the nested dispatch is still within
+ * the current portlet application and therefore need to reset to the initial path method values during includes.
+ * </p>
+ * <p>
+ * Furthermore, we assume at least the path INCLUDE attribute values as/if provided by the web container to be correct.
* </p>
* <p>
* However we need to retain the initial dispatch forward path attribute values <em>if</em> no new values are provided.
@@ -738,9 +741,22 @@ public class HttpServletPortletRequestWr
*/
protected void setupNestedDispatchPathValues()
{
- // Use the web container provided path values instead of the initial dispatch path values
- // whatever the current path method values: assume them correct
- pathMethodValues.copy(currPathMethodValues);
+ if (namedDispatch)
+ {
+ // only can/must support request.getContextPath()
+ pathMethodValues.contextPath = dispPathMethodValues.contextPath;
+ }
+ else
+ {
+ if (!forwarded || !isForwardingPossible())
+ {
+ pathMethodValues.copy(initPathMethodValues);
+ }
+ else // forwarded && isForwardingPossible()
+ {
+ pathMethodValues.copy(dispPathMethodValues);
+ }
+ }
// whatever the current attribute include path values: assume them correct (even if null)
pathAttributeValues.put(INCLUDE_CONTEXT_PATH, currPathAttributeValues.get(INCLUDE_CONTEXT_PATH));