Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Session API

 
Amit Tayal
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi to All
Please let me know what is "Servlet Session API".
Someone on JavaRanch said that we don't require the passing of session related info. between clinet and server if we use this API.

Is it true?

Regards
Amit
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The API revolves around the javax.servlet.http.HttpSession interface, and a few related interfaces and classes in that package. It maintains session information between requests by passing session IDs either through cookies, or by rewriting URLs to contain that ID. Both ways round-trip the ID (though not the session information itself) from the server to the client back to the server, so the statement you quote is questionable.
 
Amit Tayal
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even I was thinking the way you do but I saw a question on Javaranch where someone supported the way of maintaining session without passing session data bet. client and server.

Question I was refering is:
1) which session management technique does not transfer session information between a client and server?
a. URL rewriting.
b. Cookies.
c. Servlet session API.
d. Hidden Fields

Answer suggested is "c" but as per my understanding none is applicable.


Given below is the link to that mail:

http://www.coderanch.com/t/172883/java-Web-Component-SCWCD/certification/please-give-me-answer-these
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The servlet session API uses either cookies or URL rewriting.

Also, obviously something must be transferred back and forth between client and server, if not the actual information, then an ID of some kind to where the information is stored on the server (which can be done through all 4 mechanisms). Is seems to me that "session information" is not sufficiently defined.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic