Part of refactoring STRICT_SERVLET_COMPLIANCE so it just changes defaults
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 6 Jun 2010 18:47:14 +0000 (18:47 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 6 Jun 2010 18:47:14 +0000 (18:47 +0000)
New WRAP_SAME_OBJECT property

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

java/org/apache/catalina/core/ApplicationDispatcher.java
webapps/docs/config/systemprops.xml

index b30c4b0..42678d5 100644 (file)
@@ -70,6 +70,25 @@ final class ApplicationDispatcher
 
     private static final Log log = LogFactory.getLog(ApplicationDispatcher.class);
 
+    protected static final boolean STRICT_SERVLET_COMPLIANCE;
+
+    protected static final boolean WRAP_SAME_OBJECT;
+
+
+    static {
+        STRICT_SERVLET_COMPLIANCE = Globals.STRICT_SERVLET_COMPLIANCE;
+        
+        String wrapSameObject = System.getProperty(
+                "org.apache.catalina.core.ApplicationDispatcher.WRAP_SAME_OBJECT");
+        if (wrapSameObject == null) {
+            WRAP_SAME_OBJECT = STRICT_SERVLET_COMPLIANCE;
+        } else {
+            WRAP_SAME_OBJECT =
+                Boolean.valueOf(wrapSameObject).booleanValue();
+        }
+    }
+
+
     protected class PrivilegedForward
             implements PrivilegedExceptionAction<Void> {
         private ServletRequest request;
@@ -329,7 +348,7 @@ final class ApplicationDispatcher
         // Set up to handle the specified request and response
         State state = new State(request, response, false);
 
-        if (Globals.STRICT_SERVLET_COMPLIANCE) {
+        if (WRAP_SAME_OBJECT) {
             // Check SRV.8.2 / SRV.14.2.5.1 compliance
             checkSameObjects(request, response);
         }
@@ -504,7 +523,7 @@ final class ApplicationDispatcher
         // Set up to handle the specified request and response
         State state = new State(request, response, true);
 
-        if (Globals.STRICT_SERVLET_COMPLIANCE) {
+        if (WRAP_SAME_OBJECT) {
             // Check SRV.8.2 / SRV.14.2.5.1 compliance
             checkSameObjects(request, response);
         }
index 858c91d..b671450 100644 (file)
   <properties>
 
     <property name="org.apache.catalina. STRICT_SERVLET_COMPLIANCE">
-      <p>If this is <code>true</code> the following actions will occur:
+      <p>If this is <code>true</code> the default values will be changed for:
       <ul>
-      <li>any wrapped request or response object passed to an application
-      dispatcher will be checked to ensure that it has wrapped the original
-      request or response. (SRV.8.2 / SRV.14.2.5.1)
-      </li>
-      <li>
-        The default value will be changed for:
-        <ul>
-        <li><code>org.apache.catalina.core.ApplicationContext.GET_RESOURCE_REQUIRE_SLASH</code></li>
-        <li><code>org.apache.catalina.core.StandardHostValve.ACCESS_SESSION</code></li>
-        <li><code>org.apache.catalina.session.StandardSession.ACTIVITY_CHECK</code></li>
-        <li><code>org.apache.tomcat.util.http.ServerCookie.ALWAYS_ADD_EXPIRES</code>.</li>
-        <li><code>org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR</code>.</li>
-        <li><code>org.apache.tomcat.util.http.ServerCookie.STRICT_NAMING</code>.</li>
-        <li>The <code>tldNamespaceAware</code> attribute of any
-            <a href="context.html">Context</a> element</li>.
-        <li>The <code>tldValidation</code> attribute of any
-            <a href="context.html">Context</a> element</li>.
-        <li>The <code>xmlNamespaceAware</code> attribute of any
-            <a href="context.html">Context</a> element</li>.
-        <li>The <code>xmlValidation</code> attribute of any
-            <a href="context.html">Context</a> element</li>.
-        </ul>
-      </li>
+      <li><code>org.apache.catalina.core.ApplicationContext.GET_RESOURCE_REQUIRE_SLASH</code></li>
+      <li><code>org.apache.catalina.core.ApplicationDispatcher.WRAP_SAME_OBJECT</code></li>
+      <li><code>org.apache.catalina.core.StandardHostValve.ACCESS_SESSION</code></li>
+      <li><code>org.apache.catalina.session.StandardSession.ACTIVITY_CHECK</code></li>
+      <li><code>org.apache.tomcat.util.http.ServerCookie.ALWAYS_ADD_EXPIRES</code>.</li>
+      <li><code>org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR</code>.</li>
+      <li><code>org.apache.tomcat.util.http.ServerCookie.STRICT_NAMING</code>.</li>
+      <li>The <code>tldNamespaceAware</code> attribute of any
+          <a href="context.html">Context</a> element</li>.
+      <li>The <code>tldValidation</code> attribute of any
+          <a href="context.html">Context</a> element</li>.
+      <li>The <code>xmlNamespaceAware</code> attribute of any
+          <a href="context.html">Context</a> element</li>.
+      <li>The <code>xmlValidation</code> attribute of any
+          <a href="context.html">Context</a> element</li>.
       </ul>
       </p>
       <p>Note that changing a number of the above defaults is likely to break
       else the default value will be <code>false</code>.</p>
     </property>
 
+    <property name="org.apache.catalina.core. ApplicationDispatcher.WRAP_SAME_OBJECT">
+      <p>If this is <code>true</code> then any wrapped request or response
+      object passed to an application dispatcher will be checked to ensure that
+      it has wrapped the original request or response. If
+      <code>org.apache.catalina.STRICT_SERVLET_COMPLIANCE</code> is set to
+      <code>true</code>, the default of this setting will be <code>true</code>,
+      else the default value will be <code>false</code>.</p>
+    </property>
+    
     <property
     name="org.apache.tomcat.util.http. ServerCookie.ALLOW_EQUALS_IN_VALUE">
       <p>If this is <code>true</code> Tomcat will allow <code>=</code>