| Author |
Sending a session cookie in the response
|
Jose Esteban
Ranch Hand
Joined: Nov 28, 2004
Posts: 102
|
|
In page 231 of HFSJ you can read: ------------------------------------------ Sending a session cookie in the response HttpSession session = request.getSession(); ... everything else happens automatically. ... You don't set the Cookie into the response (under the Set-Cookie header). ------------------------------------------ Since the getSession() method doesn't have any reference to the response, I don't understand how this method can set a cookie into the response. Anybody has an explanation?
|
 |
Ganeshji Marwaha
Greenhorn
Joined: Sep 16, 2004
Posts: 27
|
|
I will try to attempt this question. The container is the one who provides the servlet with reference to request and response objects it creates. so, obviously the container will have a reference to the response object, until the response is completely written to the client. Then both request and response may be GC-ed.
|
-- Ganeshji Marwaha<br />SCJP<br />SCWCD<br />SCBCD<br />MCP, MCP+SB, MCSD
|
 |
Bassam Zahid
Ranch Hand
Joined: Mar 09, 2005
Posts: 61
|
|
I think this is done by the container by "adding a header containing cookie object" in response object. The container might do it this way: Of course, the container has references to request / response and other objects.
|
BS<br />SCJP 1.4 88%<br />SCWCD 1.4 86%
|
 |
Jose Esteban
Ranch Hand
Joined: Nov 28, 2004
Posts: 102
|
|
|
Thanks
|
 |
 |
|
|
subject: Sending a session cookie in the response
|
|
|