This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Servlets and the fly likes JSESSIONID Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "JSESSIONID" Watch "JSESSIONID" New topic
Author

JSESSIONID

Malhar Barai
Author
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
Hi Marty,
Is JSESSIONID a cookie ??
How does the container & application manage it ??
MB


Malhar Barai
SOA & Java Book
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

It is a transient cookie i.e. it dies when the user closes the browser or becomes invalid when it is invalidated at the server side. If cookies are disabled then you can use URL rewriting.


Groovy
Marty Hall
Author
Ranch Hand

Joined: Jan 02, 2003
Posts: 111
Is JSESSIONID a cookie ??
How does the container & application manage it ??

If the server is using cookies for session tracking, then the name of the cookie used will be JSESSIONID. So, for example, calling request.getSession will result in the server checking to see if there is already an incoming cookie called JSESSIONID and setting an outgoing cookie of that name if not.
Normally, you never deal directly with the cookie; it is a behind-the-scenes tool used by server. However, that cookie has no max age, which means it will be stored in the browser's memory and lost when the user quits the browser. This is normally the behavior you want, but sometimes people want to use the session tracking API but have it based on persistent cookies. In such a situation, you can grab the incoming JSESSIONID cookie, set its max age with setMaxAge, and send it back out again with response.addCookie.
Cheers-
- Marty


Java training and consulting
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSESSIONID