>>> Heinz Wehner <[EMAIL PROTECTED]> 29-Jan-00 9:26:19 PM >>>

>"To properly maintain the session, you must call getSession
>before any output is written to the response. (If you respond
>using a Writer, then you must call getSession before accessing
>the Writer, not just before sending any response data.)"

>Can somebody explain why this is a requirement?

Yes.

When output is first sent on a servlet's Writer or OutputStream the
servlet engine will send the compute and output the response header
before any actual output.

Any session sent in a cookie will have to be set in that response
header.

So the session must be setup before the response header is written.

Curiously this would not be required using session re-writing, since
nothing gets set in the header.

Hope that explains it.



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

Reply via email to