You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Mel Martinez <me...@yahoo.com> on 2001/02/21 05:43:03 UTC

TC3.2.1 - response commit on included JSPs

Hi folks,

I've spotted what looks like a bug in the jasper
compiler of TC3.2.1 - if this is old news, just let me
know and I'll shut up.

There are two parts to this:

1) the _jspService() method generated by the jasper
compiler uses a try{ ... }catch{...}finally{...}
block.  The finally clause looks like so:

 }finally{
   out.flush();
    _jspxFactory.releasePageContext(pageContext);
 }

Q: shouldn't the their be a check to see if the
current request is the result of a dynamic include
before we flush the buffer?

2) Examination of
org.apache.jasper.runtime.JspWriterImpl and the
response classes shows that flush() has set the
response.isCommitted() flag of the HttpServletResponse
object before response.flushBuffer() has been called.

Q: JavaDoc for the ServletResponse.flushBuffer()
method implies that it should be the one to set the
'committed' state of the response object:

"Forces any content in the buffer to be written to the
client. A call to this method automatically commits
the response, meaning the status code and headers will
be written."

Without getting stuck on the details of either of the
above issues, the real issue is that as it stands
above, if you do a dynamic include of a JSP page then
the response object is committed upon the return of
the method.  I don't believe that is correct behavior.

Is this fixed in a later release?  If so, which one
should I upgrade to?

Thanks,

mel

Dr. Mel Martinez
G1440, Inc.

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/

Re: TC3.2.1 - response commit on included JSPs

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Mel Martinez wrote:

> Without getting stuck on the details of either of the
> above issues, the real issue is that as it stands
> above, if you do a dynamic include of a JSP page then
> the response object is committed upon the return of
> the method.  I don't believe that is correct behavior.
>

Arguably not correct, but it was a workaround to a worse problem in Tomcat 3.2-b6 that
would otherwise have required a pretty substantial rearchitecting of 3.2.  The old BugRat
system (and the CVS commits) have details on the rationale, but we added a flush to the
code in Tomcat 3.2 that handles includes.

>
> Is this fixed in a later release?  If so, which one
> should I upgrade to?
>

Tomcat 4.0 does not exhibit this problem, and does not force a flush.  I do not know the
status of 3.3 in this respect.


>
> Thanks,
>
> mel
>

Craig McClanahan