Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Session Scope

 
Greenhorn
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:

SRV.7.3
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

Arjun
 
Ranch Hand
Posts: 393
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
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).]
 
Your mind is under my control .... your will is now mine .... read this tiny ad
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic