-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

André,

On 11/9/2009 9:55 PM, André Warnier wrote:
> Christopher Schultz wrote:
>>
>> I wish you'd tell us what the heck you're trying to do because I'm
>> certain there's an easier way to do it.
>>
> Like maybe just add an attribute to the session, containing the path
> where the session was begat ?
> (if I remember the original exposé correctly)

I was thinking of something even slightly more brute-force-y like:

Write a filter (my favorite!) that you map multiple times to your
webapp, once for each URI segment that represents the old, separate webapps.

The filter wraps the request which wraps HttpSession objects handed-out
by the requests. The HttpSession wrapped is configured with the URI
segment from the old webapp and basically represents a prefix used to
prepend to all session keys. The HttpSession object you get from the
wrapper only gives you access to keys that have the proper prefix.

So, the "real" session has data like:

"/oldWebappA:foo" -> "This is a string from the old 'A'"
"/oldWebappB:foo" -> "This is a string from the old 'B'"

When the code from "oldWebappA" requests the value for the key "foo",
the wrapped HttpSession prepends "/oldWebappA:" to the beginning of the
key and returns "This is a string from the old 'A'". When the code from
"oldWebappB" does the same, it gets "This is a string from the old 'B'".

You can also go crazy and use a search order like:

a. If URI + key has a value, return that
b. else, return value for just the bare key

This would allow sessions to share /some/ data, but everything else
would be segmented.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkr50owACgkQ9CaO5/Lv0PBPfgCePjtorZAbO159mYG6FR+JSoGN
/7oAnRJ1WSS6t73jk1SgcvHOK0jLj2YW
=kKky
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to