You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cr...@locus.apache.org on 2000/04/26 18:15:17 UTC
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core RequestDispatcherImpl.java Response.java ResponseImpl.java
craigmcc 00/04/26 09:15:16
Modified: src/share/org/apache/tomcat/core RequestDispatcherImpl.java
Response.java ResponseImpl.java
Log:
Fix for a spec compliance bug -- the output buffer on the response stream
was not getting reset when RequestDispatcher.forward() is called.
However, two issues remain:
* The spec is not crystal clear here (and a couple of other places)
whether headers and cookies should get erased as well (i.e. call
response.reset()), or just the data buffer. A clarification question
is in order.
* The fix doesn't seem to be completely effective. One of the Watchdog
tests for this fails because it outputs the contents of the forwarded-to
page, followed by the contents of the original page -- which appear to
have gotten buffered someplace.
More work is required to track this down.
Revision Changes Path
1.23 +3 -0 jakarta-tomcat/src/share/org/apache/tomcat/core/RequestDispatcherImpl.java
Index: RequestDispatcherImpl.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/RequestDispatcherImpl.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- RequestDispatcherImpl.java 2000/04/18 23:16:13 1.22
+++ RequestDispatcherImpl.java 2000/04/26 16:15:14 1.23
@@ -129,6 +129,9 @@
if (realResponse.isBufferCommitted())
throw new IllegalStateException(sm.getString("rdi.forward.ise"));
+ // reset the output buffer but not the headers and cookies
+ realResponse.resetBuffer();
+
// the strange case in a separate method.
if( name!=null) {
forwardNamed( request, response );
1.18 +3 -0 jakarta-tomcat/src/share/org/apache/tomcat/core/Response.java
Index: Response.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Response.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- Response.java 2000/04/17 21:02:27 1.17
+++ Response.java 2000/04/26 16:15:15 1.18
@@ -150,6 +150,9 @@
public void reset() throws IllegalStateException ;
+ // Reset the response buffer but not headers and cookies
+ public void resetBuffer() throws IllegalStateException ;
+
/** Any implementation needs to notify ContextManger
*/
public void flushBuffer() throws IOException ;
1.24 +10 -3 jakarta-tomcat/src/share/org/apache/tomcat/core/ResponseImpl.java
Index: ResponseImpl.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ResponseImpl.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- ResponseImpl.java 2000/04/25 17:54:15 1.23
+++ ResponseImpl.java 2000/04/26 16:15:15 1.24
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ResponseImpl.java,v 1.23 2000/04/25 17:54:15 costin Exp $
- * $Revision: 1.23 $
- * $Date: 2000/04/25 17:54:15 $
+ * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ResponseImpl.java,v 1.24 2000/04/26 16:15:15 craigmcc Exp $
+ * $Revision: 1.24 $
+ * $Date: 2000/04/26 16:15:15 $
*
* ====================================================================
*
@@ -349,6 +349,13 @@
// Clear the headers
if( notIncluded) headers.clear();
+ }
+
+ // Reset the response buffer but not headers and cookies
+ public void resetBuffer() throws IllegalStateException {
+
+ out.reset(); // May throw IllegalStateException
+
}
public void flushBuffer() throws IOException {