tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1156530 - in /tomcat/trunk/java/org/apache/catalina/connector: LocalStrings.properties Response.java
Date Thu, 11 Aug 2011 08:13:57 GMT
Author: markt
Date: Thu Aug 11 08:13:56 2011
New Revision: 1156530

URL: http://svn.apache.org/viewvc?rev=1156530&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=41718
RFC2616 says redirects should include a response body.

Modified:
    tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties
    tomcat/trunk/java/org/apache/catalina/connector/Response.java

Modified: tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties?rev=1156530&r1=1156529&r2=1156530&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties Thu Aug 11 08:13:56
2011
@@ -47,6 +47,7 @@ coyoteResponse.reset.ise=Cannot call res
 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
 
 #

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=1156530&r1=1156529&r2=1156530&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/Response.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Response.java Thu Aug 11 08:13:56 2011
@@ -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);
         }



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


Mime
View raw message