Nic,
now I understand: according to Craig's reply, prior to API 2.2,
providing a response buffer and when to commit this buffer was
something left to the servlet engine. Getting the session from
a request before accessing a response Writer is guaranteed to
work with all servlet engines regardless of their API level.
Regards,
Heinz Wehner
(Karlsruhe, Germany)
> -----Original Message-----
>
> >>> Heinz Wehner <[EMAIL PROTECTED]> 30-Jan-00 6:26:21 PM >>>
> >However, it's still not clear why you must even do this before
> >sending any output in case you respond using a writer. My
> >guess would be that by accessing a Writer the servlet container
> >already writes the response header.
>
> >Is that correct? I'm also uncertain as to wether this behaviour
> >conforms with the Servlet API specification.
>
> I don't think that is correct.
>
> It is not *necessary* for a servlet engine to *commit* the response
> when response.getWriter() is called.
>
> In fact, it is not necessary for a servlet engine to commit the
> response when output is performed.
>
> You can establish whether a response is commited by using
> response.isCommited().
>
> (However, since you can't set the session after the response has been
> commited you should ensure that you get the session before it is
> possible to commit the response).
>
> I was not aware that any servlet engine committed the response on
> response.getWriter() - I don't think they should personally but it is
> an implementation detail that will depend on the servlet engine.
>
> Having said that I don't think a good implementation would do this.
>
>
> Nic Ferrier
___________________________________________________________________________
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