Hey all.

Background:
We are packaging our apps as a collection of functional modules. For example
a shopping cart app would be packaged as multiple Servlet2.2 WAR (web
application
archive) files that would then be deployed in a servlet container. Each
webapp (e.g. cart, store, checkout) would be deployed in its own servlet
context. They have logic that lets them work alone as a standalone module or
together as a cohesive application.

We decided to use the Servlet session tracking mechanism to store data that
is shared between modules

One example of key/value data that would be stored in the session is:
subscriber=true.

We are running into trouble though. I have noticed that different contexts
(in Tomcat 3.2.1) create different sessions ids. This means that if I login
and set session.setAttribute("subscriber", "true") in the /entrylogic
context, and then goto (in the same call) the /checkout context and attempt
to
retrieve session.getAttribute("subscriber"), the getAttribute will return
null because the sessions (ids) are different.

Does anyone know of a way to share sessions between contexts (or the
equivalent)? Can someone explain this behaviour?

Thanks in advance,
-Andy

Reply via email to