This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HFSJ Doubt, Mock exam on page 265 (Session management), 5 question. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HFSJ Doubt, Mock exam on page 265 (Session management), 5 question." Watch "HFSJ Doubt, Mock exam on page 265 (Session management), 5 question." New topic
Author

HFSJ Doubt, Mock exam on page 265 (Session management), 5 question.

Mateus Lucio
Ranch Hand

Joined: Jul 27, 2006
Posts: 57
Could someone explain me why this option is correct please!?

Option D: When using cookies for session tracking, the name of the session tracking cookie must be jsessionid.

I can understand if all the web containers that support servlets and jsps use a cookie named jsessionid but i can't understand why the cookie MUST have this name.

I couldn't find a place that says that, and the HFSJ errata doesn't have anything mentioning that question. Could someone help me on that please?

Thank you all !!



Studying ...
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Web containers will look for that cookie, so we need to use the same name for everybody. Otherwise how would the container know which cookie to look for ?


[My Blog]
All roads lead to JavaRanch
Mateus Lucio
Ranch Hand

Joined: Jul 27, 2006
Posts: 57
Isn't the Web Container that writes this cookie? or it's written by java API?
I mean, if it's container job to write that cookie and it's also his job to read it, then any name could be used like, "tomcatseessionid" or "jettysessionid" or "iissessionid" as long as he understands what he has written, I don't see why the cookie must be named "jsessionid".

I know that this matter isn't so important, I just couldn't not ask it!!
Chinmaya Chowdary
Ranch Hand

Joined: Apr 21, 2008
Posts: 432
Hi, Mateus. I think it is due to compatablity between the servers, especially in clustering environment, where different server's work together(when session needs to migrate from one server to another server). Thankyou.
Mateus Lucio
Ranch Hand

Joined: Jul 27, 2006
Posts: 57
Thank you!!!

That makes sense ... when you deploy a web app in a clustered environment, you don't need (or sometimes you can't) to use the same web container in all machines, if you don't use the same cookie name your session info couldn't be transferred from one node to another!


Thanks again!!!
 
Don't get me started about those stupid light bulbs.
 
subject: HFSJ Doubt, Mock exam on page 265 (Session management), 5 question.
 
Similar Threads
SCWCD - On Cookies
Problem related to cookies
JSESSIONID
JSESSIONID mandatory name only in cookies not in url rewriting
Head First Problem