You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Leonard Megliola <lm...@mminternet.com> on 2002/08/05 02:13:24 UTC
Session Scope Question/Problem
I'm not sure I understand how sessions work across different webapps and
within a single webapps. My problem is related to the latter of the
two. I am using the ROOT context in which I have two
sub-directories. When a user accesses any JSP objects within sub-directory
A, all JSP objects accessed within sub-directory A during the session will
see the stored object. If I then go to sub-directory B and back to
sub-directory A, the object is no longer there.
Could someone enlighten me as to the behavior involved here and a suitable
solution to this problem?
I have looked through the Tomcat docs (not architectural docs though), the
Web and the Tomcat User mailing list and haven't found anything useful. I
thought that this might be related to sharing sessions between contexts,
but I can't verify that, nor do I understand why two directories under the
same context would be considered separate.
Thanks in advance,
Leonard
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Session Scope Question/Problem
Posted by Leonard Megliola <lm...@mminternet.com>.
At 07:55 PM 8/4/2002 -0700, Craig R. McClanahan wrote:
>Without code snippets of how your app is put together, the best anyone can
>do is guess -- and that is not going to be very helpful to anyone. And I
>can say, with a fairly high degree of confidence, that it's probably
>something *you* are doing wrong, not Tomcat :-).
I appreciate the explanation. Unfortunately there is only one context in
the webapps directory, ROOT.
As far as code goes, I've got thousands of lines of code and would have no
clue what to put here. The only lines that have anything to do with
sessions are a couple of session put and get calls that are in
sub-directory A. the second directory (the one that would appear to have
an effect on the session) never does anything at all with the session.
Curious.
Leonard
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Session Scope Question/Problem
Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Sun, 4 Aug 2002, Leonard Megliola wrote:
> Date: Sun, 04 Aug 2002 18:39:56 -0700
> From: Leonard Megliola <lm...@mminternet.com>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> To: Tomcat Users List <to...@jakarta.apache.org>
> Subject: Re: Session Scope Question/Problem
>
>
>
>
>
> At 09:21 PM 8/4/2002 -0400, you wrote:
> >Hello,
> >
> >To quote the API documentation of the javax.servlet.http.HttpSession
> >interface:
> >"Provides a way to identify a user across more than one page request or visit
> >to a Web site and to store information about that user... Session information
> >is scoped only to the current web application (ServletContext), so
> >information stored in one context will not be directly visible in another. "
> >HttpSession is an abstraction that has nothing to do with directories. There
> >is one HttpSession instance per client per webapp. It means any JSP within a
> >webapp can access the same HttpSession instance per one client. I am not sure
> >what you mean by a "JSP object" but if it's a JSP page then it's limited to
> >the single HttpSession per webapp per client.
> >Paul
>
> Right, I understand that much. But I'm talking about the ROOT context. So
> unless the ROOT context is treated different than other contexts,
It's not ... all contexts are created equal in terms of how session
management works.
> all of
> the accesses to sub-directories within the ROOT context should be
> considered the same context and therefore should not have problems seeing
> the context.
>
If your subdirectory path matches the context path of another webapp, then
it is *not* part of the root context -- it has it's own.
For example, if your webapps directory has "ROOT" and "foo" subdirectories
in it, the URLs "http://localhost:8080/index.jsp" and
"http://localhost:8080/foo/index.jsp" are in different contexts, with
different sessions.
> But really, different sessions shouldn't matter anyhow even if different
> sub-directories within the ROOT context are treated as separate virtual
> contexts. My problem is that visiting one sub-directory of the ROOT
> context seems to delete the session information for another sub-directory
> of the root context.
>
> Anyone else care to take a guess?
>
> Thank you for you help though,
Without code snippets of how your app is put together, the best anyone can
do is guess -- and that is not going to be very helpful to anyone. And I
can say, with a fairly high degree of confidence, that it's probably
something *you* are doing wrong, not Tomcat :-).
>
> Leonard
>
Craig
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Session Scope Question/Problem
Posted by Leonard Megliola <lm...@mminternet.com>.
At 09:21 PM 8/4/2002 -0400, you wrote:
>Hello,
>
>To quote the API documentation of the javax.servlet.http.HttpSession
>interface:
>"Provides a way to identify a user across more than one page request or visit
>to a Web site and to store information about that user... Session information
>is scoped only to the current web application (ServletContext), so
>information stored in one context will not be directly visible in another. "
>HttpSession is an abstraction that has nothing to do with directories. There
>is one HttpSession instance per client per webapp. It means any JSP within a
>webapp can access the same HttpSession instance per one client. I am not sure
>what you mean by a "JSP object" but if it's a JSP page then it's limited to
>the single HttpSession per webapp per client.
>Paul
Right, I understand that much. But I'm talking about the ROOT context. So
unless the ROOT context is treated different than other contexts, all of
the accesses to sub-directories within the ROOT context should be
considered the same context and therefore should not have problems seeing
the context.
But really, different sessions shouldn't matter anyhow even if different
sub-directories within the ROOT context are treated as separate virtual
contexts. My problem is that visiting one sub-directory of the ROOT
context seems to delete the session information for another sub-directory
of the root context.
Anyone else care to take a guess?
Thank you for you help though,
Leonard
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Session Scope Question/Problem
Posted by Paul Yunusov <py...@rogers.com>.
On Sunday 04 August 2002 08:13 pm, Leonard Megliola wrote:
> I'm not sure I understand how sessions work across different webapps and
> within a single webapps. My problem is related to the latter of the
> two. I am using the ROOT context in which I have two
> sub-directories. When a user accesses any JSP objects within sub-directory
> A, all JSP objects accessed within sub-directory A during the session will
> see the stored object. If I then go to sub-directory B and back to
> sub-directory A, the object is no longer there.
>
> Could someone enlighten me as to the behavior involved here and a suitable
> solution to this problem?
>
> I have looked through the Tomcat docs (not architectural docs though), the
> Web and the Tomcat User mailing list and haven't found anything useful. I
> thought that this might be related to sharing sessions between contexts,
> but I can't verify that, nor do I understand why two directories under the
> same context would be considered separate.
>
> Thanks in advance,
>
> Leonard
Hello,
To quote the API documentation of the javax.servlet.http.HttpSession
interface:
"Provides a way to identify a user across more than one page request or visit
to a Web site and to store information about that user... Session information
is scoped only to the current web application (ServletContext), so
information stored in one context will not be directly visible in another. "
HttpSession is an abstraction that has nothing to do with directories. There
is one HttpSession instance per client per webapp. It means any JSP within a
webapp can access the same HttpSession instance per one client. I am not sure
what you mean by a "JSP object" but if it's a JSP page then it's limited to
the single HttpSession per webapp per client.
Paul
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>