You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by da...@apache.org on 2007/02/04 19:21:24 UTC
svn commit: r503451 -
/cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/DynamicProxyRequestHandler.java
Author: danielf
Date: Sun Feb 4 10:21:23 2007
New Revision: 503451
URL: http://svn.apache.org/viewvc?view=rev&rev=503451
Log:
Changed rules for creating new context path, servlet path and path info for a servlet service called by the dispatcher servlet.
Before:
newContextPath = contextPath
newServletPath = servletPath + mountPath
newPathInfo = pathInfo.substring(mountPath.length())
After:
newContextPath = contextPath + servletPath
newServletPath = mountPath
newPathInfo = pathInfo.substring(mountPath.length())
The issue was discussed in http://marc.theaimsgroup.com/?t=116993162500002&r=1&w=2.
Modified:
cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/DynamicProxyRequestHandler.java
Modified: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/DynamicProxyRequestHandler.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/DynamicProxyRequestHandler.java?view=diff&rev=503451&r1=503450&r2=503451
==============================================================================
--- cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/DynamicProxyRequestHandler.java (original)
+++ cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/DynamicProxyRequestHandler.java Sun Feb 4 10:21:23 2007
@@ -22,8 +22,8 @@
import javax.servlet.http.HttpServletRequest;
/**
* A dynamic wrapper for servlet requests that overwrites the
- * getServletPath and getPathInfo methods to relect the mount
- * path of the block servlet.
+ * getContextPath, getServletPath and getPathInfo methods to
+ * reflect the mount path of the block servlet.
*
* @version $Id$
*/
@@ -31,12 +31,14 @@
private final HttpServletRequest wrapped;
private final String mountPath;
+ private static final Method getContextPathMethod;
private static final Method getServletPathMethod;
private static final Method getPathInfoMethod;
static {
- getPathInfoMethod = getHttpServletRequestMethod("getPathInfo");
+ getContextPathMethod = getHttpServletRequestMethod("getContextPath");
getServletPathMethod = getHttpServletRequestMethod("getServletPath");
+ getPathInfoMethod = getHttpServletRequestMethod("getPathInfo");
}
/**
* Helper method for getting methods of the HttpServletRequest interface
@@ -71,12 +73,14 @@
*/
public Object invoke(Object proxy, Method method, Object[] arguments)
throws Throwable {
- if (method.equals(getPathInfoMethod)) {
- String pathInfo = wrapped.getPathInfo().substring(mountPath.length());
- return pathInfo.length() == 0 ? null : pathInfo;
+ if (method.equals(getContextPathMethod)) {
+ return wrapped.getContextPath() + wrapped.getServletPath();
} else if (method.equals(getServletPathMethod)) {
- return wrapped.getServletPath() + mountPath;
- } else {
+ return mountPath;
+ } else if (method.equals(getPathInfoMethod)) {
+ String pathInfo = wrapped.getPathInfo().substring(mountPath.length());
+ return pathInfo.length() == 0 ? null : pathInfo;
+ } else {
return method.invoke(wrapped, arguments);
}
}