More fixes for https://issues.apache.org/bugzilla/show_bug.cgi?id=50026
authortimw <timw@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 6 Oct 2010 07:22:46 +0000 (07:22 +0000)
committertimw <timw@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 6 Oct 2010 07:22:46 +0000 (07:22 +0000)
Calculating complete resource path when accessed via RequestDispatcher.include()

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1004912 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/servlets/DefaultServlet.java

index 30af597..2ce3a3e 100644 (file)
@@ -348,21 +348,24 @@ public class DefaultServlet
         if (request.getAttribute(Globals.INCLUDE_REQUEST_URI_ATTR) != null) {
             String result = (String) request.getAttribute(
                                             Globals.INCLUDE_PATH_INFO_ATTR);
-            if (result == null)
+            if (result == null) {
                 result = (String) request.getAttribute(
                                             Globals.INCLUDE_SERVLET_PATH_ATTR);
-            if ((result == null) || (result.equals("")))
+            } else {
+                result = (String) request.getAttribute(
+                                  Globals.INCLUDE_SERVLET_PATH_ATTR) + result;
+            }
+            if ((result == null) || (result.equals(""))) {
                 result = "/";
+            }
             return (result);
         }
 
         // No, extract the desired path directly from the request
         String result = request.getPathInfo();
         if (result == null) {
-            // Mapped to '/'
             result = request.getServletPath();
         } else {
-            // Mapped to '/path/*' so get entire path under context
             result = request.getServletPath() + result;
         }
         if ((result == null) || (result.equals(""))) {