>>> Rich Bednar <[EMAIL PROTECTED]> 26-Apr-01 6:00:26 PM >>>
>I am developing a Servlet based, multi-screen
>application using WebSphere 3.5 (Servlet 2.2).
>The Session object will change as the user navigates
>about thru the screens. If the user then opens another
>Browser window and navigates to a different screen in
>my application, will Websphere get confused?
>Do I have 2 separate Session objects or just one?
>I've looked at the 2.2 Specification and it doesn't seem
>to be addressed.
You should be ok.
This comes down to the mechanics of how sessions are implemented. As
you probably know there are 2 main ways: cookies and url re-writing.
Let's look at how it works in a cookie environment.
Let's say you have a webapp mapped to "/rich" on the server
"richhost:8000".
You create a session during a request. When you come to write the
response for the request the servlet engine automatically creates a
cookie with the session identifier and places it on the response.
Cookies are quite sophisticated really, more so than people realise.
When the browser recieves a cookie it parses it to understand what
URLs is should send the cookie to.... The cookie that servlet engines
use for session purposes identifies the host of your servlet container
and the path of your webapp.
So in our example your cookie will state "richhost" for the hosts
that it should be sent to and "/tich" for the paths it should be sent
to.
Whenever the browser makes a request for any path on "richhost" that
is, or is under "/rich" it will send the cookie.
When the servlet engine recieves the session cookie it says "hey!
this request is part of an existing session" and goes to get the
session data associated with the session id in the cookie and thus:
you have a session.
When a user opens a second browser window the current cookies are
shared between the 2 windows, so the session will carry over from
browser window to browser window.
There is a situation where this doesn't work. A user might create a
new browser completly (you can just about do this with Netscape). If
that happens it's unlikely that the 2 browsers will be sharing the
cookies and you'll have to do something else to share state between
the 2 browsers.
This doesn't happen very often though.
So the short answer is: don't worry about it. You should be fine.
The reason we don't mention it in the spec BTW is because it's not
really a spec issue, we state clearly how sessions are maintained and
leave it to you to understand how.
Nic Ferrier
Advert:
Nic is available for work: fixed or short term contracts. Contact him
directly.
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html