DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5957>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5957

RequestDispatcher.include() not working with wrapped responses

[EMAIL PROTECTED] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID



------- Additional Comments From [EMAIL PROTECTED]  2002-01-30 10:20 
-------
I think I've found the problem in the filter. In EFResponseWrapper.java, 
flushBuffer() calls super.flushBuffer(). With this call in place, the following 
happens:

1. incl.jsp is processed and test.jsp gets included correctly (both via 
<jsp:include> and RequestDispatcher)

2. Tomcat calls flushBuffer() on the response which gets forwarded to the 
original response. This commits the response (all headers are sent to the 
client).

3. EntryFilter tries to set the content length, but the (wrong) length has 
already been sent to the client. This seems to cause the strange "loading 
forever" behaviour.

The obvious solution is to remove the super.flushBuffer() call in 
EFResponseWrapper. However, there is one more thing you have to change to make 
it work: Both the including and the included jsp call getWriter(), and 
EFResponseWrapper creates a new PrintWriter for both calls. Without the 
super.flushBuffer() call, only one of these gets flushed (in this case, the one 
of the including JSP).

The solution is simple: Make sure you only construct one PrintWriter and 
EFServletOutputStream and return these on every getWriter()/getOutputStream() 
call.

Your example works as soon as both issues are fixed (tested it with my Tomcat 
4.0.1 final). The only remaining problem is that the output of the included JSP 
is put _before_ the contents of the including JSP. This is no bug, but a 
general JSP/RequestDispatcher problem. If you need help with this, you can send 
me eMail directly (this is a user question and should not be discussed on 
tomcat-dev; however, I don't read tomcat-user).

I'm closing this bug as "invalid" since the error is in the test case. I hope 
that's OK - if not, please reopen.

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to