From 7f2119c1475065fc20424c09cff56b1f760b080a Mon Sep 17 00:00:00 2001 From: markt Date: Sun, 6 Jun 2010 18:29:26 +0000 Subject: [PATCH] Part of refactoring STRICT_SERVLET_COMPLIANCE so it just changes defaults New ACCESS_SESSION property git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@951922 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/catalina/core/StandardHostValve.java | 23 ++++++++++++++++++++-- webapps/docs/config/systemprops.xml | 16 ++++++++++----- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/java/org/apache/catalina/core/StandardHostValve.java b/java/org/apache/catalina/core/StandardHostValve.java index 8b235f008..796efcfdd 100644 --- a/java/org/apache/catalina/core/StandardHostValve.java +++ b/java/org/apache/catalina/core/StandardHostValve.java @@ -61,6 +61,25 @@ final class StandardHostValve private static final Log log = LogFactory.getLog(StandardHostValve.class); + protected static final boolean STRICT_SERVLET_COMPLIANCE; + + protected static final boolean ACCESS_SESSION; + + static { + STRICT_SERVLET_COMPLIANCE = Boolean.valueOf(System.getProperty( + "org.apache.catalina.STRICT_SERVLET_COMPLIANCE", + "false")).booleanValue(); + + String accessSession = System.getProperty( + "org.apache.catalina.core.StandardHostValve.ACCESS_SESSION"); + if (accessSession == null) { + ACCESS_SESSION = STRICT_SERVLET_COMPLIANCE; + } else { + ACCESS_SESSION = + Boolean.valueOf(accessSession).booleanValue(); + } + } + //------------------------------------------------------ Constructor public StandardHostValve() { super(true); @@ -147,7 +166,7 @@ final class StandardHostValve // Access a session (if present) to update last accessed time, based on a // strict interpretation of the specification - if (Globals.STRICT_SERVLET_COMPLIANCE) { + if (ACCESS_SESSION) { request.getSession(false); } @@ -205,7 +224,7 @@ final class StandardHostValve // Access a session (if present) to update last accessed time, based on a // strict interpretation of the specification - if (Globals.STRICT_SERVLET_COMPLIANCE) { + if (ACCESS_SESSION) { request.getSession(false); } diff --git a/webapps/docs/config/systemprops.xml b/webapps/docs/config/systemprops.xml index 5e7ce12dc..72a8c11b9 100644 --- a/webapps/docs/config/systemprops.xml +++ b/webapps/docs/config/systemprops.xml @@ -228,10 +228,6 @@ dispatcher will be checked to ensure that it has wrapped the original request or response. (SRV.8.2 / SRV.14.2.5.1) -
  • every request that is associated with a session will cause the - session's last accessed time to be updated regardless of whether or not - the request explicitly accesses the session. (SRV.7.6) -
  • ServletContext.getResource/getResourceAsStream must start with "/"
    if set to false, code like getResource("myfolder/myresource.txt") will work @@ -239,6 +235,7 @@
  • The default value will be changed for: