my dog learned polymorphism*
The moose likes Servlets and the fly likes getting session 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 » Java » Servlets
Bookmark "getting session" Watch "getting session" New topic
Author

getting session

saravanan ragunathan
Ranch Hand

Joined: Aug 02, 2010
Posts: 84
please assume this situation
for the first response to the client container sent both
Set-cookie and url rewritting..when it recives the second
raquest (the client browser supports Set-Cookie header
and sent both sessionID cookie and sessionID appended to URL)


from which part the above code reads sessionID


"I Love Java Ranch"
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3013
    
  35

The mechanism of request.getSession() has the capability of tracking the session ID from URL or cookie. The session cookie, if presence, contains the session ID.


Founder of ExamLab and Systemup
See how I can help you to become an awesome programmer
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

You do not have to worry when the ID is readed.

Just know that the method "request.getSession();" brings you the client session.

And by default if is no session was created before (like first time in the page, timeout), it will creat a new session for you.


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
 
 
subject: getting session
 
Similar Threads
cookie / url writing problem
URL Rewriting - Doubt
creating new session manually
session cookie/url writing doubt
URL rewriting doubt?