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
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));
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);
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>
<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
+ "/". 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>