Bookmark Topic Watch Topic
  • New Topic

Session management

 
Pratap gogireddy
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Report post to moderator

hi friends

how the web server maintains the session with the client?

where the sessions are created and stored in servlets?


can any one please help me?

thanks in advance...
 
Pete Nelson
Ranch Hand
Posts: 147
Debian Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Report post to moderator
See my reply to your "Cookies" question - they are related.
 
Vijitha Kumara
Bartender
Posts: 3916
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Report post to moderator
how the web server maintains the session with the client?

Cookie is sent as a response header (or in the URL for browsers don't accept cookies) which in turn sent by the browser so that the container can match existing session with the given session ID.
where the sessions are created and stored in servlets?

Sessions are stored in the server memory. Servlets do not contain them but can access them through the HttpRequest object.
 
Pete Nelson
Ranch Hand
Posts: 147
Debian Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Report post to moderator
Vijitha Kumara wrote:Cookie is sent as a response header (or in the URL for browsers don't accept cookies)

Just to clarify - HTTP Cookies ONLY exist in the request & response headers, and not in the URL. HttpSession will use Cookies if it can, but will failover to using a sessionid in the URL if Cookies are disabled. In this case, you're technically not using HTTP Cookies (the browser does not allow them), but does show yet another advantage to using the higher-level HttpSession over the lower-level HTTP Cookie.
 
Pratap gogireddy
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Report post to moderator
Thanks vijith and pete for your reply....
 
    Bookmark Topic Watch Topic
  • New Topic