Author: markt
Date: Mon Mar 8 18:58:28 2010
New Revision: 920449
URL: http://svn.apache.org/viewvc?rev=920449&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48661
If the response has been committed, include the error page like Jasper does
Modified:
tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java
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=920449&r1=920448&r2=920449&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java Mon Mar
8 18:58:28 2010
@@ -416,18 +416,25 @@
request.setPathInfo(errorPage.getLocation());
try {
- // Reset the response (keeping the real error code and message)
- response.resetBuffer(true);
-
// Forward control to the specified location
ServletContext servletContext =
request.getContext().getServletContext();
RequestDispatcher rd =
servletContext.getRequestDispatcher(errorPage.getLocation());
- rd.forward(request.getRequest(), response.getResponse());
- // If we forward, the response is suspended again
- response.setSuspended(false);
+ if (response.isCommitted()) {
+ // Response is committed - including the error page is the
+ // best we can do
+ rd.include(request.getRequest(), response.getResponse());
+ } else {
+ // Reset the response (keeping the real error code and message)
+ response.resetBuffer(true);
+
+ rd.forward(request.getRequest(), response.getResponse());
+
+ // If we forward, the response is suspended again
+ response.setSuspended(false);
+ }
// Indicate that we have successfully processed this custom page
return (true);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]