Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=41718
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 11 Aug 2011 08:13:56 +0000 (08:13 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 11 Aug 2011 08:13:56 +0000 (08:13 +0000)
RFC2616 says redirects should include a response body.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1156530 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/connector/LocalStrings.properties
java/org/apache/catalina/connector/Response.java

index 197f11d..7eea0ff 100644 (file)
@@ -47,6 +47,7 @@ coyoteResponse.reset.ise=Cannot call reset() after response has been committed
 coyoteResponse.resetBuffer.ise=Cannot reset buffer after response has been committed
 coyoteResponse.sendError.ise=Cannot call sendError() after the response has been committed
 coyoteResponse.sendRedirect.ise=Cannot call sendRedirect() after the response has been committed
+coyoteResponse.sendRedirect.note=<html><body><p>Redirecting to <a href="{0}">{0}</a></p></body></html>
 coyoteResponse.setBufferSize.ise=Cannot change buffer size after data has been written
 
 #
index 6b8ca7b..f32afdb 100644 (file)
@@ -1327,13 +1327,17 @@ public class Response
             return; 
 
         // Clear any data content that has been buffered
-        resetBuffer();
+        resetBuffer(true);
 
         // Generate a temporary redirect to the specified location
         try {
             String absolute = toAbsolute(location);
             setStatus(SC_FOUND);
             setHeader("Location", absolute);
+            PrintWriter writer = getWriter();
+            writer.print(
+                    sm.getString("coyoteResponse.sendRedirect.note", absolute));
+            flushBuffer();
         } catch (IllegalArgumentException e) {
             setStatus(SC_NOT_FOUND);
         }