Author: markt Date: Sun Nov 30 14:58:06 2008 New Revision: 721921 URL: http://svn.apache.org/viewvc?rev=721921&view=rev Log: Use resetBuffer() as suggested by the spec. Makes custom and standard error page handling consistent
Modified: tomcat/tc6.0.x/trunk/ (props changed) tomcat/tc6.0.x/trunk/STATUS.txt tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/Response.java tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardHostValve.java tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc6.0.x/trunk/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Sun Nov 30 14:58:06 2008 @@ -1 +1 @@ -/tomcat/trunk:601180,606992,673796,673820,683982,684001,684081,684234,684269-684270,687503,687645,690781,691392,691805,692748,695053,695311,696780,696782,698012,698227,698236,698613,699427,699634,709294,709816,711126 +/tomcat/trunk:601180,606992,673796,673820,683982,684001,684081,684234,684269-684270,687503,687645,690781,691392,691805,692748,695053,695311,696780,696782,698012,698227,698236,698613,699427,699634,709294,709816,710063,710125,711126 Modified: tomcat/tc6.0.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=721921&r1=721920&r2=721921&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Sun Nov 30 14:58:06 2008 @@ -143,15 +143,6 @@ +1: markt, remm (with a trivial improvement) -1: fhanik - InternalAprInputBuffer/InternalNioInputBuffer should provide the same behavior (+1 for same changes in all three) -* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=42409 - Use resetBuffer() as suggested by the spec. Makes custom and standard error - page handling consistent - http://svn.apache.org/viewvc?rev=710063&view=rev - http://svn.apache.org/viewvc?rev=710125&view=rev (to address Remy's comment) - +1: markt, fhanik, pero - 0: remm (I think it should now be ok) - -1: - * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=41861 Add major version number to Tomcat service name created by Windows installer http://svn.apache.org/viewvc?rev=710066&view=rev Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/Response.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/Response.java?rev=721921&r1=721920&r2=721921&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/Response.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/Response.java Sun Nov 30 14:58:06 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/tc6.0.x/trunk/java/org/apache/catalina/core/StandardHostValve.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardHostValve.java?rev=721921&r1=721920&r2=721921&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardHostValve.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardHostValve.java Sun Nov 30 14:58:06 2008 @@ -368,7 +368,7 @@ if (exception == null) return (null); - Class clazz = exception.getClass(); + Class<?> clazz = exception.getClass(); String name = clazz.getName(); while (!Object.class.equals(clazz)) { ErrorPage errorPage = context.findErrorPage(name); @@ -405,16 +405,8 @@ request.setPathInfo(errorPage.getLocation()); try { - - // Reset the response if possible (else IllegalStateException) - //hres.reset(); // Reset the response (keeping the real error code and message) - Integer statusCodeObj = - (Integer) request.getAttribute(Globals.STATUS_CODE_ATTR); - int statusCode = statusCodeObj.intValue(); - String message = - (String) request.getAttribute(Globals.ERROR_MESSAGE_ATTR); - response.reset(statusCode, message); + response.resetBuffer(true); // Forward control to the specified location ServletContext servletContext = Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=721921&r1=721920&r2=721921&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Sun Nov 30 14:58:06 2008 @@ -70,6 +70,11 @@ <bug>41407</bug>: Add CLIENT-CERT support to the JAAS Realm. (markt) </add> <fix> + <bug>42409</bug>: Make custom and standard error page handling + consistent by using resetBuffer() which will not alter previously set + headers. (markt) + </fix> + <fix> <bug>43656</bug>: Correct regression in previous fix for this bug. Patch provided by Nils Eckert. (markt) </fix> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]