GigaSpaces XAP 9.5 API

org.openspaces.pu.container.jee.context
Class BootstrapWebApplicationContextListener

java.lang.Object
  extended by org.openspaces.pu.container.jee.context.BootstrapWebApplicationContextListener
All Implemented Interfaces:
EventListener, javax.servlet.ServletContextListener

public class BootstrapWebApplicationContextListener
extends Object
implements javax.servlet.ServletContextListener

Bootstap servlet context listener allowing to get the ClusterInfo, BeanLevelProperties, and handle an optional pu.xml file within META-INF/spring by loading it.

The different web containers support in OpenSpaces will use prepareForBoot(java.io.File, org.openspaces.core.cluster.ClusterInfo, org.openspaces.core.properties.BeanLevelProperties) before the web application is started. It will basically marshall the ClusterInfo and BeanLevelProperties so they can be read when the contextInitialized(javax.servlet.ServletContextEvent) is called. It will also change the web.xml in order to add this class as a context listener.

During context initialization, the marshalled ClusterInfo and BeanLevelProperties can be read and put in the servlet context (allowing us to support any web container).

If there is a pu.xml file, it will be started as well, with the application context itself set in the servlet context (can then be used by the ProcessingUnitContextLoaderListener as well as all its beans read and set in the servlet context under their respective names.

Author:
kimchy

Constructor Summary
BootstrapWebApplicationContextListener()
           
 
Method Summary
 void contextDestroyed(javax.servlet.ServletContextEvent servletContextEvent)
           
 void contextInitialized(javax.servlet.ServletContextEvent servletContextEvent)
           
static Object objectFromByteBuffer(byte[] buffer)
           
static byte[] objectToByteBuffer(Object obj)
           
static void prepareForBoot(File warPath, ClusterInfo clusterInfo, BeanLevelProperties beanLevelProperties)
          Changes the web.xml to include the bootstrap context listener and the request statistics filter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BootstrapWebApplicationContextListener

public BootstrapWebApplicationContextListener()
Method Detail

contextInitialized

public void contextInitialized(javax.servlet.ServletContextEvent servletContextEvent)
Specified by:
contextInitialized in interface javax.servlet.ServletContextListener

contextDestroyed

public void contextDestroyed(javax.servlet.ServletContextEvent servletContextEvent)
Specified by:
contextDestroyed in interface javax.servlet.ServletContextListener

prepareForBoot

public static void prepareForBoot(File warPath,
                                  ClusterInfo clusterInfo,
                                  BeanLevelProperties beanLevelProperties)
                           throws Exception
Changes the web.xml to include the bootstrap context listener and the request statistics filter

Throws:
Exception

objectFromByteBuffer

public static Object objectFromByteBuffer(byte[] buffer)
                                   throws Exception
Throws:
Exception

objectToByteBuffer

public static byte[] objectToByteBuffer(Object obj)
                                 throws Exception
Throws:
Exception

GigaSpaces XAP 9.5 API

Copyright © GigaSpaces.