A quick question for all you Servlet API gurus :-)
I have some information that I need to store past the end of an HttpSession lifecyle.
This information needs to be available to all servlets in the web application.
Regarding the ServletContext, the Servlet Specification states:
SRV.3.2 Scope of a ServletContext Interface
There is one instance object of the ServletContext interface associated with each
web application deployed into a container. In cases where the container is
distributed over many virtual machines, a web application will have an instance of
the ServletContext for each VM.
Servlets in a container that were not deployed as part of a web application are
implicitly part of a �default� web application and have a default ServletContext.
In a distributed container, the default ServletContext is non-distributable and
must only exist in one VM.
Therefore, this information cannot be stored in the web application's ServletContext. However, we are using tomcat, which can be configured to allow access to the default context with the following entry in the server.xml configuration file:
This default context is guaranteed to be in a single JVM only, so perhaps we can store stuff in there. Glorious hack, or dangerous approach?
For example, the following JSPs can share information between web applications, so I am guessing this approach should work for distributed web applications also:
File 1:
File 2:
Comments please :-)