Author: mmillson
Date: 2010-12-09 13:36:36 -0500 (Thu, 09 Dec 2010)
New Revision: 1617
Modified:
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/connector/Response.java
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/core/StandardHostValve.java
Log:
Allow extra response headers to be sent with a custom error page for [JBPAPP-5559].
Modified:
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/connector/Response.java
===================================================================
---
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/connector/Response.java 2010-12-09
15:17:37 UTC (rev 1616)
+++
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/connector/Response.java 2010-12-09
18:36:36 UTC (rev 1617)
@@ -675,6 +675,30 @@
/**
+ * 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) {
+
+ resetBuffer();
+
+ if(resetWriterStreamFlags) {
+ usingOutputStream = false;
+ usingWriter = false;
+ isCharacterEncodingSet = false;
+ }
+
+ }
+
+
+ /**
* Set the buffer size to be used for this Response.
*
* @param size The new buffer size
Modified:
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/core/StandardHostValve.java
===================================================================
---
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/core/StandardHostValve.java 2010-12-09
15:17:37 UTC (rev 1616)
+++
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/core/StandardHostValve.java 2010-12-09
18:36:36 UTC (rev 1617)
@@ -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);
@@ -406,15 +406,8 @@
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 =
Show replies by date