From: markt Date: Sun, 6 Jun 2010 18:39:33 +0000 (+0000) Subject: Part of refactoring STRICT_SERVLET_COMPLIANCE so it just changes defaults X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=cb505a85979fb735c7c37425ee4ca147d3ea8637;p=tomcat7.0 Part of refactoring STRICT_SERVLET_COMPLIANCE so it just changes defaults New GET_RESOURCE_REQUIRE_SLASH property git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@951923 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/core/ApplicationContext.java b/java/org/apache/catalina/core/ApplicationContext.java index d901b1a19..5610765a0 100644 --- a/java/org/apache/catalina/core/ApplicationContext.java +++ b/java/org/apache/catalina/core/ApplicationContext.java @@ -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); diff --git a/webapps/docs/config/systemprops.xml b/webapps/docs/config/systemprops.xml index 72a8c11b9..cbc894f67 100644 --- a/webapps/docs/config/systemprops.xml +++ b/webapps/docs/config/systemprops.xml @@ -229,12 +229,9 @@ request or response. (SRV.8.2 / SRV.14.2.5.1)
  • - ServletContext.getResource/getResourceAsStream must start with "/"
    - if set to false, code like getResource("myfolder/myresource.txt") will work -
  • -
  • The default value will be changed for: