my dog learned polymorphism*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Session Scope Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Session Scope" Watch "Session Scope" New topic
Author

Session Scope

Arjun Anand
Greenhorn

Joined: May 24, 2001
Posts: 25
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


Arjun
james edwin
Ranch Hand

Joined: Nov 22, 2001
Posts: 393
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).]


Regards,
James
 
 
subject: Session Scope