tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r451838 - in /tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina: Globals.java core/ApplicationDispatcher.java core/ApplicationFilterChain.java
Date Sun, 01 Oct 2006 23:17:17 GMT
Author: markt
Date: Sun Oct  1 16:17:16 2006
New Revision: 451838

URL: http://svn.apache.org/viewvc?view=rev&rev=451838
Log:
Add STRICT_SERVLET_COMPLIANCE option as per 6.x
Wrap fix for 34956 in a test for this.

Modified:
    tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/Globals.java
    tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java
    tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/ApplicationFilterChain.java

Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/Globals.java
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/Globals.java?view=diff&rev=451838&r1=451837&r2=451838
==============================================================================
--- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/Globals.java (original)
+++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/Globals.java Sun Oct 
1 16:17:16 2006
@@ -321,4 +321,12 @@
         "javax.servlet.context.tempdir";
 
 
+    /**
+     * The master flag which controls strict servlet specification 
+     * compliance.
+     */
+    public static final boolean STRICT_SERVLET_COMPLIANCE =
+        Boolean.valueOf(System.getProperty("org.apache.catalina.STRICT_SERVLET_COMPLIANCE",
"false")).booleanValue();
+
+
 }

Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java?view=diff&rev=451838&r1=451837&r2=451838
==============================================================================
--- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java
(original)
+++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java
Sun Oct  1 16:17:16 2006
@@ -324,8 +324,10 @@
         // Set up to handle the specified request and response
         setup(request, response, false);
         
-        // Check SRV.8.2 / SRV.14.2.5.1 compliance
-        checkSameObjects();
+        if (Globals.STRICT_SERVLET_COMPLIANCE) {
+            // Check SRV.8.2 / SRV.14.2.5.1 compliance
+            checkSameObjects();
+        }
 
         // Identify the HTTP-specific request and response objects (if any)
         HttpServletRequest hrequest = null;
@@ -509,8 +511,10 @@
         // Set up to handle the specified request and response
         setup(request, response, true);
 
-        // Check SRV.8.2 / SRV.14.2.5.1 compliance
-        checkSameObjects();
+        if (Globals.STRICT_SERVLET_COMPLIANCE) {
+            // Check SRV.8.2 / SRV.14.2.5.1 compliance
+            checkSameObjects();
+        }
         
         // Create a wrapped response to use for this request
         // ServletResponse wresponse = null;

Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/ApplicationFilterChain.java
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/ApplicationFilterChain.java?view=diff&rev=451838&r1=451837&r2=451838
==============================================================================
--- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/ApplicationFilterChain.java
(original)
+++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/ApplicationFilterChain.java
Sun Oct  1 16:17:16 2006
@@ -31,6 +31,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.catalina.Globals;
 import org.apache.catalina.InstanceEvent;
 import org.apache.catalina.security.SecurityUtil;
 import org.apache.catalina.util.InstanceSupport;
@@ -50,8 +51,18 @@
 final class ApplicationFilterChain implements FilterChain {
 
     // Used to enforce requirements of SRV.8.2 / SRV.14.2.5.1
-    private static ThreadLocal lastServicedRequest = new ThreadLocal();
-    private static ThreadLocal lastServicedResponse = new ThreadLocal();
+    private final static ThreadLocal lastServicedRequest;
+    private final static ThreadLocal lastServicedResponse;
+
+    static {
+        if (Globals.STRICT_SERVLET_COMPLIANCE) {
+            lastServicedRequest = new ThreadLocal();
+            lastServicedResponse = new ThreadLocal();
+        } else {
+            lastServicedRequest = null;
+            lastServicedResponse = null;
+        }
+    }
     
     // -------------------------------------------------------------- Constants
 
@@ -234,8 +245,10 @@
 
         // We fell off the end of the chain -- call the servlet instance
         try {
-            lastServicedRequest.set(request);
-            lastServicedResponse.set(response);
+            if (Globals.STRICT_SERVLET_COMPLIANCE) {
+                lastServicedRequest.set(request);
+                lastServicedResponse.set(response);
+            }
             support.fireInstanceEvent(InstanceEvent.BEFORE_SERVICE_EVENT,
                                       servlet, request, response);
             if ((request instanceof HttpServletRequest) &&
@@ -280,8 +293,10 @@
             throw new ServletException
               (sm.getString("filterChain.servlet"), e);
         } finally {
-            lastServicedRequest.set(null);
-            lastServicedResponse.set(null);
+            if (Globals.STRICT_SERVLET_COMPLIANCE) {
+                lastServicedRequest.set(null);
+                lastServicedResponse.set(null);
+            }
         }
 
     }



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


Mime
View raw message