tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r951923 - in /tomcat/trunk: java/org/apache/catalina/core/ApplicationContext.java webapps/docs/config/systemprops.xml
Date Sun, 06 Jun 2010 18:39:33 GMT
Author: markt
Date: Sun Jun  6 18:39:33 2010
New Revision: 951923

URL: http://svn.apache.org/viewvc?rev=951923&view=rev
Log:
Part of refactoring STRICT_SERVLET_COMPLIANCE so it just changes defaults
New GET_RESOURCE_REQUIRE_SLASH property

Modified:
    tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java
    tomcat/trunk/webapps/docs/config/systemprops.xml

Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java?rev=951923&r1=951922&r2=951923&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java Sun Jun  6 18:39:33
2010
@@ -93,6 +93,24 @@ import org.apache.catalina.Globals;
 public class ApplicationContext
     implements ServletContext {
 
+    protected static final boolean STRICT_SERVLET_COMPLIANCE;
+
+    protected static final boolean GET_RESOURCE_REQUIRE_SLASH;
+
+
+    static {
+        STRICT_SERVLET_COMPLIANCE = Globals.STRICT_SERVLET_COMPLIANCE;
+        
+        String activityCheck = System.getProperty(
+                "org.apache.catalina.core.ApplicationContext.GET_RESOURCE_REQUIRE_SLASH");
+        if (activityCheck == null) {
+            GET_RESOURCE_REQUIRE_SLASH = STRICT_SERVLET_COMPLIANCE;
+        } else {
+            GET_RESOURCE_REQUIRE_SLASH =
+                Boolean.valueOf(activityCheck).booleanValue();
+        }
+    }
+
     // ----------------------------------------------------------- Constructors
 
 
@@ -497,7 +515,7 @@ public class ApplicationContext
         if (path == null)
             throw new MalformedURLException(sm.getString("applicationContext.requestDispatcher.iae",
path));
 
-        if (!path.startsWith("/") && Globals.STRICT_SERVLET_COMPLIANCE)
+        if (!path.startsWith("/") && GET_RESOURCE_REQUIRE_SLASH)
             throw new MalformedURLException(sm.getString("applicationContext.requestDispatcher.iae",
path));
 
         
@@ -541,7 +559,7 @@ public class ApplicationContext
         if (path == null)
             return (null);
 
-        if (!path.startsWith("/") && Globals.STRICT_SERVLET_COMPLIANCE)
+        if (!path.startsWith("/") && GET_RESOURCE_REQUIRE_SLASH)
             return null;
 
         String normalizedPath = RequestUtil.normalize(path);

Modified: tomcat/trunk/webapps/docs/config/systemprops.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/systemprops.xml?rev=951923&r1=951922&r2=951923&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/config/systemprops.xml (original)
+++ tomcat/trunk/webapps/docs/config/systemprops.xml Sun Jun  6 18:39:33 2010
@@ -229,12 +229,9 @@
       request or response. (SRV.8.2 / SRV.14.2.5.1)
       </li>
       <li>
-        <code>ServletContext.getResource/getResourceAsStream</code> must start
with "/"<br/>
-        if set to false, code like <code>getResource("myfolder/myresource.txt")</code>
will work
-      </li>
-      <li>
         The default value will be changed for:
         <ul>
+        <li><code>rg.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>
@@ -274,6 +271,17 @@
       <code>true</code> will be used.</p>
     </property>
 
+    <property name="org.apache.catalina.core. ApplicationContext.GET_RESOURCE_REQUIRE_SLASH">
+      <p>If this is <code>true</code> then the path passed to
+      <code>ServletContext.getResource()</code> or
+      <code>ServletContext.getResourceAsStream()</code> must start with
+      &quot;/&quot;. If <code>false</code>, code like
+      <code>getResource("myfolder/myresource.txt")</code> will work. 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>



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


Mime
View raw message