You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2008/09/17 13:11:43 UTC

svn commit: r696240 - /tomcat/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java

Author: markt
Date: Wed Sep 17 04:11:42 2008
New Revision: 696240

URL: http://svn.apache.org/viewvc?rev=696240&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=45441
Filters for INCLUDE/FORWARD need to be matched against servletPath+pathinfo

Modified:
    tomcat/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java

Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java?rev=696240&r1=696239&r2=696240&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java Wed Sep 17 04:11:42 2008
@@ -429,7 +429,7 @@
             if (disInt.intValue() != ApplicationFilterFactory.ERROR) {
                 state.outerRequest.setAttribute
                     (ApplicationFilterFactory.DISPATCHER_REQUEST_PATH_ATTR,
-                     servletPath);
+                     getCombinedPath());
                 state.outerRequest.setAttribute
                     (ApplicationFilterFactory.DISPATCHER_TYPE_ATTR,
                      Integer.valueOf(ApplicationFilterFactory.FORWARD));
@@ -442,7 +442,23 @@
     }
     
     
-    
+    /**
+     * Combine the servletPath and the pathInfo. If pathInfo is
+     * <code>null</code> it is ignored. If servletPath is <code>null</code> then
+     * <code>null</code> is returned.
+     * @return The combined path with pathInfo appended to servletInfo
+     */
+    private String getCombinedPath() {
+        if (servletPath == null) {
+            return null;
+        }
+        if (pathInfo == null) {
+            return servletPath;
+        }
+        return servletPath + pathInfo;
+    }
+
+
     /**
      * Include the response from another resource in the current response.
      * Any runtime exception, IOException, or ServletException thrown by the
@@ -499,7 +515,7 @@
                     Integer.valueOf(ApplicationFilterFactory.INCLUDE));
             wrequest.setAttribute(
                     ApplicationFilterFactory.DISPATCHER_REQUEST_PATH_ATTR,
-                    servletPath);
+                    getCombinedPath());
             invoke(state.outerRequest, state.outerResponse, state);
         }
 
@@ -531,7 +547,7 @@
                     Integer.valueOf(ApplicationFilterFactory.INCLUDE));
             wrequest.setAttribute(
                     ApplicationFilterFactory.DISPATCHER_REQUEST_PATH_ATTR,
-                    servletPath);
+                    getCombinedPath());
             invoke(state.outerRequest, state.outerResponse, state);
         }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org