Session
Hai,cananyone tell me in a simple way about session in java.
It is very confusing to me. suppose if i am visiting www.yahoo.com and then if i shift to www.google.com does it come under same session or treated as another.
suppose if i take new browser window does it come under same session as previous or not.
[330 byte] By [
succora] at [2007-11-26 18:39:19]

A session is not a client side thing. It's on the serverside. So google and yahoo should treat your request in different sessions since they are complete different servers. A session is the server's way to track your identity and to make sure it doesn't mix up state for different users.
> suppose if i take new browser window does it come under same session as previous or not.
That depends on the way your server implements session tracking. If it works with cookies, a second browser window could be identified as the same session. Some platforms like some mobile phones don't support cookies. In this case the application server can use a jsessionId encoded into the URL. Two windows can get a different session in this case, or they can use the same session by copying the URL (whcih can lead to conflicts).
Peter
sessions are maintained in the server. so when you open yahoo.com in a browser it creates a new session in the yahoo.com server, and then open google.com in the same browser it creates another totally different session in google.com.
though when you open the same website in a different browser, the case is different, the cookies come into place here...if the website has implemented cookies (gmail.com) and your browser has cookies enabled, then the new browser will open the same session that you had in the previous browser window. If the website (mail.yahoo.com) does not implement cookies then the new browser will always create a new session.
Session is a generic term which has been included in http protocol and any language which uses http or https may it be java or any other has the same concept of session.
so now about your query:
when u open the browser window a new session is started then and there. say u hit yahoo.com then actually the server assigns a unique session id to your session and this id is used for session tracking. the session tracking is effected by the use of cookies which are sent in the request header. on the server side u have to get the session id from the header to validate the user or to perform any other desired action.
now if using the same browser u hit google.com, in that case google will assign a different session id for the same session and use this id for session tracking till u r on the google site.
if you open a new browser, then a new session will be created.
to kill the session from the client side....u will have to log ...or else the session is automatically killed on the server depending on the request time out setting of the server.
roaha at 2007-7-9 6:13:22 >
