public abstract class AbstractPolygeneServletBootstrap extends Object implements javax.servlet.ServletContextListener, org.apache.polygene.bootstrap.ApplicationAssembler
Application is set as a ServletContext attribute named using a constant.
In your servlets, filters, whatever has access to the ServletContext use the following code to get a
handle on the Application:
org.apache.polygene.api.structure.Application application; application = ( Application ) servletContext.getAttribute( PolygeneServletSupport.APP_IN_CTX ); // Or, shorter: application = PolygeneServletSupport.application( servletContext );Rembember that the servlet specification states: In cases where the container is distributed over many virtual machines, a Web application will have an instance of the ServletContext for each JVM. Context attributes are local to the JVM in which they were created. This prevents ServletContext attributes from being a shared memory store in a distributed container. When information needs to be shared between servlets running in a distributed environment, the information should be placed into a session, stored in a database, or set in an Enterprise JavaBeans component.
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.polygene.api.PolygeneAPI |
api |
protected org.apache.polygene.api.structure.Application |
application |
protected org.apache.polygene.api.structure.ApplicationDescriptor |
applicationModel |
protected org.apache.polygene.bootstrap.Energy4Java |
polygene |
| Constructor and Description |
|---|
AbstractPolygeneServletBootstrap() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
afterApplicationActivation(org.apache.polygene.api.structure.Application app) |
protected void |
afterApplicationPassivation(org.apache.polygene.api.structure.Application app) |
protected void |
beforeApplicationActivation(org.apache.polygene.api.structure.Application app) |
protected void |
beforeApplicationPassivation(org.apache.polygene.api.structure.Application app) |
void |
contextDestroyed(javax.servlet.ServletContextEvent sce) |
void |
contextInitialized(javax.servlet.ServletContextEvent sce) |
protected org.apache.polygene.api.PolygeneAPI api
protected org.apache.polygene.bootstrap.Energy4Java polygene
protected org.apache.polygene.api.structure.ApplicationDescriptor applicationModel
protected org.apache.polygene.api.structure.Application application
public final void contextInitialized(javax.servlet.ServletContextEvent sce)
contextInitialized in interface javax.servlet.ServletContextListenerprotected void beforeApplicationActivation(org.apache.polygene.api.structure.Application app)
protected void afterApplicationActivation(org.apache.polygene.api.structure.Application app)
public final void contextDestroyed(javax.servlet.ServletContextEvent sce)
contextDestroyed in interface javax.servlet.ServletContextListenerprotected void beforeApplicationPassivation(org.apache.polygene.api.structure.Application app)
protected void afterApplicationPassivation(org.apache.polygene.api.structure.Application app)