Allow the AddDefaultCharsetValve to be effective when a writer is used
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 7 Mar 2009 19:42:09 +0000 (19:42 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 7 Mar 2009 19:42:09 +0000 (19:42 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@751313 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/connector/Response.java

index 349b49d..d99a399 100644 (file)
@@ -811,9 +811,11 @@ public class Response
         if (included)
             return;     
         
-        // Ignore any call made after the getWriter has been invoked
-        // The default should be used
-        if (usingWriter)
+        // Normally calls to this method after the getWriter has been invoked
+        // will be ignored. The exception allows the addDefaultCharsetValve to
+        // insert the default charset in appropriate circumstances 
+        if (usingWriter && (isCharacterEncodingSet ||
+                !getCharacterEncoding().equalsIgnoreCase(charset)))
             return;
 
         coyoteResponse.setCharacterEncoding(charset);