Hi, In Tomcat, entering a context is done simply by setting the context classloader and sometimes firing some random events (like the ones from the ServletRequestListener). This isn't so good for integration and could use improvements, in addition to at least one place where this is not done at all (very recently a bug reported to me that indicated there was an issue with SSO session expiration, and indeed it expires sessions from other contexts just like that).
So I would propose harmonizing this (and fix the SSO issue too, obviously), with a new dedicated ThreadBindingListener interface (two methods: bind/unbind) and a get/set for it also in Context, to be used for integration. Although usually generic listeners are used (and there can be multiple ones), this has worked well for me so far. Ideally I would have liked to also take over the privileged actions in a utility class, but this would make PA use less optimal (for example in the request dispatcher). Comments ? (or better ideas ?) Rémy