Geoff Soutter wrote:
> [snip]
> Over all, I think it's a reasonable compromise.... although sometimes I wish
> the servlet API team explained the rationale behind their design
> decisions...!
>
One of the motivations for the buffering support in 2.2 was undoubtedly JSP --
especially the <jsp:forward> mechanism that uses RequestDispatcher.forward()
internally. The JSP 1.0 spec required that the JSP engine itself do this
buffering -- the functionality was migrated to the servlet spec so that
servlets could utilize the feature as well, if they wanted to.
In a servlet, since you have complete control over things, you can buffer all
you want. If you decide in the middle of your servlet to forward to a
different servlet (or JSP page) to do the response, you just throw away your
buffer.
But it's not quite so easy in the code generated to support a JSP page -- it
starts "writing" to the output stream as soon as it sees any template text.
The buffering support lets you use <jsp:forward> in the middle of your page,
without having to do anything else special. (NOTE: I'm not an advocate of
mixing logic or control flow in the JSP page, but since this is one of the
design goals of JSP, there needed to be an appropriate mechanism to support
it.)
> [snip]
> What bugs me about this whole buffering thing is that the buffering scheme I
> have written for 2.0/2.1 servlets works just as well as the one in 2.2.
> However, the things that only the servlet API could do for buffering were
> not included... e.g. buffering a RD.include() and letting me extract the
> results from the buffer. :-(
>
That one (post-processing included output) is a *whole* different kettle of
fish -- which has triggered lots of discussion and debate over the lifetime of
the servlet API. Look back in the archives at all the flamewar message threads
about "servlet chaining" to see what I mean. :-)
>
> Geoff
>
Craig McClanahan
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html