File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cookies and session tracking

 
Raj Jindal
Ranch Hand
Posts: 50
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do cookies keeps track of the session ?
OR
They help in keeping track of the session information ?
 
Paul Kelcey
Ranch Hand
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm no expert but I understand that modern web-containers automatically handle session tracking for you using either cookies or URL rewriting. I think it depends on the client. If the client accepts cookies, then the web-container uses cookies, otherwise it uses URL rewriting.
As a developer you don't really need to be too concerned about how the web-container does it. The web-container provides a HttpSession object for you to use to store information for a particular user. I think this is what you're talking about when you say "session information"?
The web-container knows what HttpSession object to associate with a request using either one of these session tracking methods. You just need to use the HttpSession object to store and retrieve information when you're processing a request.
The typical example is a shopping cart. You would just use the HttpSession object to store shopping items in it. When they wanted to check out, you'd retrieve all of the shopping items from the HttpSession object.
It wasn't always this way however and previously you had to do it yourself. Nowadays however the web-container will take care of it for you.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic