I think I'm completely misunderstanding the question.
First of all, applications in 2 different contexts can not share a session!
Therefore, how you are getting context 2 to putValue() (you really should be
using the more current setAttribute()) into the session of context 1 is
beyond me.

This is from the servlet 2.3 specifications:

Final Version
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.

After reading that it should make sense why the browser redirection to a new
context causes a new session to be created by context1 but it doesnt explain
how you were able to manipulate a session object of context 1 in context 2.
Am I somehow misreading this?

Can you provide some code examples? Are you storing the HTTPSession object
manually to be included in the response to context1?
-Tim

-----Original Message-----
From: Nic Ferrier [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 12, 2002 2:38 PM
To: [EMAIL PROTECTED]
Subject: Re: Session Tracking and multiple contexts


"Venkitachalam, Sankar" <[EMAIL PROTECTED]> writes:

> Does it not look like a serious problem? Does anybody have a solution to
it?
> It happens to me for Tomcat 4.0. May be it is an issue that should be
> addressed to a tomcat discussion group.

It's probably not a Tomcat issue. See my point below:


> >I have a problem with session tracking. The scenario is as follows:
> >
> >1) "Web app A" in "context1" uses a URLconnection WITHIN A SERVLET IN
> >CONTEXT1 to send data to "webapp B" running in a different
server/different
> >context ( context 2).
> >2) Context 2/Web app2 creates some session objects using
> >HttpSession.putValue() method. Context 2 servlet sends response back to
> >servlet running in "context1" which in turn shows the response in
browser.
> >
> >3) The browser then sends a GET or POST request, this time directly to
the
> >server running "WebApp B/context2".
> >
> >My issue is that after the step 3,everytime a
HttpSession.getSession(true)
> >is returning a new session, so I am not able to implement session
tracking
> >using the HttpSession class. Cookies are enabled in the browser.

That is correct behaviour (probably). The first session is being
created between the servlet and the client in the "context1".

When your browser tries to connect to the "context2" it will get a
new session and attach it to the browser.

"context2" now has at least 2 sessions, one attached to the webapp called
"context1" and one attached to the browser.



Or are you saying that *every* request from the browser to the
servlet results in a new session?


Nic

___________________________________________________________________________
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

___________________________________________________________________________
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

Reply via email to