tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r710125 - in /tomcat/trunk/java/org/apache/catalina: connector/Response.java core/StandardHostValve.java
Date Mon, 03 Nov 2008 18:53:38 GMT
Author: markt
Date: Mon Nov  3 10:53:37 2008
New Revision: 710125

URL: http://svn.apache.org/viewvc?rev=710125&view=rev
Log:
As per Remy's review comment, make sure we continue to reset the writer/stream flags before
forwarding to a custom error page.

Modified:
    tomcat/trunk/java/org/apache/catalina/connector/Response.java
    tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java

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=710125&r1=710124&r2=710125&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/Response.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Response.java Mon Nov  3 10:53:37 2008
@@ -670,16 +670,38 @@
      *  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.
      *

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java?rev=710125&r1=710124&r2=710125&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java Mon Nov  3 10:53:37
2008
@@ -406,7 +406,7 @@
 
         try {
             // Reset the response (keeping the real error code and message)
-            response.resetBuffer();
+            response.resetBuffer(true);
 
             // Forward control to the specified location
             ServletContext servletContext =



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


Mime
View raw message