You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kk...@apache.org on 2010/01/14 09:59:19 UTC

svn commit: r899124 - in /tomcat/trunk: java/org/apache/catalina/connector/Response.java webapps/docs/config/systemprops.xml

Author: kkolinko
Date: Thu Jan 14 08:59:19 2010
New Revision: 899124

URL: http://svn.apache.org/viewvc?rev=899124&view=rev
Log:
Allow compliance with SRV.15.2.22.1 to be controlled separately from STRICT_SERVLET_COMPLIANCE,
and turn it on by default.

Modified:
    tomcat/trunk/java/org/apache/catalina/connector/Response.java
    tomcat/trunk/webapps/docs/config/systemprops.xml

Modified: tomcat/trunk/java/org/apache/catalina/connector/Response.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Response.java?rev=899124&r1=899123&r2=899124&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/Response.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Response.java Thu Jan 14 08:59:19 2010
@@ -70,9 +70,21 @@
 
     // ----------------------------------------------------------- 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 @@
             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 <code>getCharacterEncoding</code> (i.e., the method

Modified: tomcat/trunk/webapps/docs/config/systemprops.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/systemprops.xml?rev=899124&r1=899123&r2=899124&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/config/systemprops.xml (original)
+++ tomcat/trunk/webapps/docs/config/systemprops.xml Thu Jan 14 08:59:19 2010
@@ -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)
       </li>
-      <li>a call to <code>Response.getWriter()</code> if no character encoding
-      has been specified will result in subsequent calls to
-      <code>Response.getCharacterEncoding()</code> returning
-      <code>ISO-8859-1</code> and the <code>Content-Type</code> response header
-      will include a <code>charset=ISO-8859-1</code> component. (SRV.15.2.22.1)
-      </li>
       <li>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.</p>
     </property>
 
+    <property name="org.apache.catalina.connector. Response.ENFORCE_ENCODING_IN_GET_WRITER">
+      <p>If this is <code>true</code> then
+      a call to <code>Response.getWriter()</code> if no character encoding
+      has been specified will result in subsequent calls to
+      <code>Response.getCharacterEncoding()</code> returning
+      <code>ISO-8859-1</code> and the <code>Content-Type</code> response header
+      will include a <code>charset=ISO-8859-1</code> component. (SRV.15.2.22.1)
+      <br />
+      If not specified, the default specification compliant value of
+      <code>true</code> will be used.</p>
+    </property>
+
     <property
     name="org.apache.catalina.session. StandardSession.ACTIVITY_CHECK">
       <p>If this is <code>true</code> or if



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