• Post Reply Bookmark Topic Watch Topic
  • New Topic

Session Scope  RSS feed

Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anybody Please explain the below paragraph. I'm totally lost
From the Servlet 2.3 Spec:

Session Scope
HttpSession objects must be scoped at the application (or servlet context) level.
The underlying mechanism, such as the cookie used to establish the session, can be
the same for different contexts, but the object referenced, including the attributes in that object, must never be shared between contexts by the container. To illustrate this requirement with an example: if a servlet uses the RequestDispatcher to call a servlet in another web application, any sessions created for and visible to the callee servlet must be different from those visible to the calling servlet.

I understand this concerns only Servlet Container providers and not Application Devlopers. Nevertheless, in a bid to understand, I fail to see how a session can be scoped at an application level.
Further, it says the cookie can be the same but the object cannot be so.
Any lights in these points please

Ranch Hand
Posts: 393
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i will try to explain something here
01) Session - if u store something in session,then that's avaiable to whole application level in that server(app context) for the same browser.Session will only for the request coming from the same client(browser).
02) Application- If u stored something in app. level then that's available to all request coming from any client(any browser).
That's the difference.If app context is changed then in new app context(different server) nothing will be avaiable.Quote from servlet specficiation
SRV.3.2 Scope of a ServletContext
There is one instance object of the ServletContext interface associated with each
web application deployed into a container.
In a distributed container, the default ServletContext is non-distributable and
must only exist in one VM."
I hope this clarifies,incase i am incorrect some where pls correct me and if anything is not clear,pls ask
[This message has been edited by james edwin (edited January 02, 2002).]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!