You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Teo <te...@gmail.com> on 2012/05/18 21:37:16 UTC
I have /subapp/a and /subapp/b. Can i have different sessions for them?
Hi,
first time posting on a mailing list, hope i'm not breaking any rules of
some sort. My problem is pretty simple but it seems a lot of people have
trouble understanding it in other forums. Let's say i have 2 main entry
points into my application: /subapp/a and /subapp/b. They are part of the
same webapp but they are somehow different and i want to distinguish
between them. Having a separate session for each of them would be the
greatest thing but is this possible for Tomcat? The path of the session
cookie (JSESSIONID) is automatically put at the root context path (so
/subapp in this example). And i don't want to have multiple wars or
multiple Tomcats... I would like this in Tomcat 7 btw... I'm trying to
avoid changing Tomcat itself so i tried to extend/wrap the usual response
classes/interfaces but no luck because Tomcat writes the Set-Cookie header
directly into the coyote response header...
Any help would be appreciated, been wrestling with this for some days...
Thanks,
Teo
Re: I have /subapp/a and /subapp/b. Can i have different sessions
for them?
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Teo,
On 5/18/12 3:37 PM, Teo wrote:
> Let's say i have 2 main entry points into my application: /subapp/a
> and /subapp/b. They are part of the same webapp but they are
> somehow different and i want to distinguish between them. Having a
> separate session for each of them would be the greatest thing
Why JSESSIONID? Why not some other cookie?
I can see several other ways to do this, but it would help if you
could explain what kinds of things you want to do when the user is in
a different "sub-section" of the webapp.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk+6oGcACgkQ9CaO5/Lv0PBw2ACfSEQNVwNEGNfg/ehJC76J4Ckt
XKsAoMMuseRkZXyrIl7KdM4T563wGxaM
=vgko
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: I have /subapp/a and /subapp/b. Can i have different sessions for them?
Posted by Pid * <pi...@pidster.com>.
On 18 May 2012, at 20:38, Teo <te...@gmail.com> wrote:
> Hi,
>
> first time posting on a mailing list, hope i'm not breaking any rules of
> some sort. My problem is pretty simple but it seems a lot of people have
> trouble understanding it in other forums.
Okay...
> Let's say i have 2 main entry
> points into my application: /subapp/a and /subapp/b.
Ok
> They are part of the
> same webapp but they are somehow different and i want to distinguish
> between them.
Ok
> Having a separate session for each of them would be the
> greatest thing but is this possible for Tomcat?
Yes, if they are separate applications.
This is a Servlet Spec requirement.
> The path of the session
> cookie (JSESSIONID) is automatically put at the root context path (so
> /subapp in this example).
The word root has a special meaning, be precise please. It usually
means ROOT - the default application whose path is '/'.
I don't think that's what you intend.
> And i don't want to have multiple wars or
> multiple Tomcats...
Why not? Work with the technology instead of against it.
If you name your app:
myapp#subappA.war
The context & cookie path will be
/myapp/subappA
Problem solved.
p
> I would like this in Tomcat 7 btw... I'm trying to
> avoid changing Tomcat itself so i tried to extend/wrap the usual response
> classes/interfaces but no luck because Tomcat writes the Set-Cookie header
> directly into the coyote response header...
>
> Any help would be appreciated, been wrestling with this for some days...
>
> Thanks,
> Teo
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org