From: kkolinko
Date: Thu, 14 Jan 2010 08:59:19 +0000 (+0000)
Subject: Allow compliance with SRV.15.2.22.1 to be controlled separately from STRICT_SERVLET_C...
X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=1ae3b09bb4456bf375d1fb7b34c20cb282cc74ce;p=tomcat7.0
Allow compliance with SRV.15.2.22.1 to be controlled separately from STRICT_SERVLET_COMPLIANCE,
and turn it on by default.
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@899124 13f79535-47bb-0310-9956-ffa450edef68
---
diff --git a/java/org/apache/catalina/connector/Response.java b/java/org/apache/catalina/connector/Response.java
index be0021509..fceb410fc 100644
--- a/java/org/apache/catalina/connector/Response.java
+++ b/java/org/apache/catalina/connector/Response.java
@@ -70,9 +70,21 @@ public class Response
// ----------------------------------------------------------- Constructors
+ /**
+ * Compliance with SRV.15.2.22.1. A call to Response.getWriter() if no
+ * character encoding has been specified will result in subsequent calls to
+ * Response.getCharacterEncoding() returning ISO-8859-1 and the Content-Type
+ * response header will include a charset=ISO-8859-1 component.
+ */
+ private static final boolean ENFORCE_ENCODING_IN_GET_WRITER;
+
static {
// Ensure that URL is loaded for SM
URL.isSchemeChar('c');
+
+ ENFORCE_ENCODING_IN_GET_WRITER = Boolean.valueOf(
+ System.getProperty("org.apache.catalina.connector.Response.ENFORCE_ENCODING_IN_GET_WRITER",
+ "true")).booleanValue();
}
public Response() {
@@ -603,7 +615,7 @@ public class Response
throw new IllegalStateException
(sm.getString("coyoteResponse.getWriter.ise"));
- if (Globals.STRICT_SERVLET_COMPLIANCE) {
+ if (ENFORCE_ENCODING_IN_GET_WRITER) {
/*
* If the response's character encoding has not been specified as
* described in getCharacterEncoding (i.e., the method
diff --git a/webapps/docs/config/systemprops.xml b/webapps/docs/config/systemprops.xml
index 4656a483b..744650742 100644
--- a/webapps/docs/config/systemprops.xml
+++ b/webapps/docs/config/systemprops.xml
@@ -225,12 +225,6 @@
dispatcher will be checked to ensure that it has wrapped the original
request or response. (SRV.8.2 / SRV.14.2.5.1)
- a call to Response.getWriter() if no character encoding
- has been specified will result in subsequent calls to
- Response.getCharacterEncoding() returning
- ISO-8859-1 and the Content-Type response header
- will include a charset=ISO-8859-1 component. (SRV.15.2.22.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)
@@ -256,6 +250,18 @@
overridden by explicitly setting the appropriate system property.
+
+ If this is true then
+ a call to Response.getWriter() if no character encoding
+ has been specified will result in subsequent calls to
+ Response.getCharacterEncoding() returning
+ ISO-8859-1 and the Content-Type response header
+ will include a charset=ISO-8859-1 component. (SRV.15.2.22.1)
+
+ If not specified, the default specification compliant value of
+ true will be used.
+
+
If this is true or if