Author: markt
Date: Fri Jul  4 20:33:31 2014
New Revision: 1607935

URL: http://svn.apache.org/r1607935
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56677
Ensure that HttpServletRequest.getServletContext() returns the correct value 
during a cross-context dispatch. 

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    
tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1607934

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java?rev=1607935&r1=1607934&r2=1607935&view=diff
==============================================================================
--- 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java 
Fri Jul  4 20:33:31 2014
@@ -30,6 +30,7 @@ import java.util.NoSuchElementException;
 
 import javax.servlet.DispatcherType;
 import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequestWrapper;
 import javax.servlet.http.HttpSession;
@@ -195,6 +196,14 @@ class ApplicationHttpRequest extends Htt
 
     // ------------------------------------------------- ServletRequest Methods
 
+    @Override
+    public ServletContext getServletContext() {
+        if (context == null) {
+            return null;
+        }
+        return context.getServletContext();
+    }
+
 
     /**
      * Override the <code>getAttribute()</code> method of the wrapped request.

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1607935&r1=1607934&r2=1607935&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Fri Jul  4 20:33:31 2014
@@ -130,6 +130,11 @@
         domain, path, httpOnly and secure as were used to set the SSO cookie.
         (markt) 
       </fix>
+      <fix>
+        <bug>56677</bug>: Ensure that
+        <code>HttpServletRequest.getServletContext()</code> returns the correct
+        value during a cross-context dispatch. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to