As per Remy's review comment, make sure we continue to reset the writer/stream flags...
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 3 Nov 2008 18:53:37 +0000 (18:53 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 3 Nov 2008 18:53:37 +0000 (18:53 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@710125 13f79535-47bb-0310-9956-ffa450edef68

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

index fa42135..e4cc50c 100644 (file)
@@ -670,16 +670,38 @@ public class Response
      *  been committed
      */
     public void resetBuffer() {
+        resetBuffer(false);
+    }
+
+    
+    /**
+     * Reset the data buffer and the using Writer/Stream flags but not any
+     * status or header information.
+     *
+     * @param resetWriterStreamFlags <code>true</code> if the internal
+     *        <code>usingWriter</code>, <code>usingOutputStream</code>,
+     *        <code>isCharacterEncodingSet</code> flags should also be reset
+     * 
+     * @exception IllegalStateException if the response has already
+     *  been committed
+     */
+    public void resetBuffer(boolean resetWriterStreamFlags) {
 
         if (isCommitted())
             throw new IllegalStateException
                 (sm.getString("coyoteResponse.resetBuffer.ise"));
 
         outputBuffer.reset();
+        
+        if(resetWriterStreamFlags) {
+            usingOutputStream = false;
+            usingWriter = false;
+            isCharacterEncodingSet = false;
+        }
 
     }
 
-
+    
     /**
      * Set the buffer size to be used for this Response.
      *
index 79b920c..6229511 100644 (file)
@@ -406,7 +406,7 @@ final class StandardHostValve
 
         try {
             // Reset the response (keeping the real error code and message)
-            response.resetBuffer();
+            response.resetBuffer(true);
 
             // Forward control to the specified location
             ServletContext servletContext =