org.apache.cayenne.conf
Class WebApplicationListener

java.lang.Object
  extended by org.apache.cayenne.conf.WebApplicationListener
All Implemented Interfaces:
java.util.EventListener, javax.servlet.http.HttpSessionListener, javax.servlet.ServletContextListener
Direct Known Subclasses:
WebApplicationContextProvider

Deprecated. since 1.2. This class is deprecated to reduce confusion due to multiple redundant choices of web application configuration. WebApplicationContextFilter is the official configuration choice for Cayenne, however you can still use a custom listener similar to WebApplicationListener if you want to.

public class WebApplicationListener
extends java.lang.Object
implements javax.servlet.http.HttpSessionListener, javax.servlet.ServletContextListener

WebApplicationListener utilizes Servlet specification 2.3 features to react on webapplication container events inializing Cayenne.

It performs the following tasks:

CayenneWebappListener must be configured in web.xml deployment descriptor as a listener of context and session events:

   <listener>
    <listener-class>org.apache.cayenne.conf.WebApplicationListener</listener-class>
    </listener>
 

Note that to set WebApplicationListener as a listener of web application events, you must use servlet containers compatible with Servlet Specification 2.3 (such as Tomcat 4.0). Listeners were only added to servlet specification in 2.3. If you are using an older container, you will need to configure Cayenne in your code.

Author:
Andrus Adamchik

Constructor Summary
WebApplicationListener()
          Deprecated.  
 
Method Summary
 void contextDestroyed(javax.servlet.ServletContextEvent sce)
          Deprecated. Currently does nothing.
 void contextInitialized(javax.servlet.ServletContextEvent sce)
          Deprecated. Establishes a Cayenne shared Configuration object that can later be obtained by calling Configuration.getSharedConfiguration().
protected  Configuration getConfiguration()
          Deprecated. Returns the current configuration.
protected  Configuration newConfiguration(javax.servlet.ServletContext sc)
          Deprecated. since 1.2
 void sessionCreated(javax.servlet.http.HttpSessionEvent se)
          Deprecated. Creates and assigns a new data context based on default domain to the session object associated with this event.
 void sessionDestroyed(javax.servlet.http.HttpSessionEvent se)
          Deprecated. Does nothing.
protected  void setConfiguration(Configuration configuration)
          Deprecated. Initializes the configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebApplicationListener

public WebApplicationListener()
Deprecated. 
Method Detail

contextInitialized

public void contextInitialized(javax.servlet.ServletContextEvent sce)
Deprecated. 
Establishes a Cayenne shared Configuration object that can later be obtained by calling Configuration.getSharedConfiguration(). This method is a part of ServletContextListener interface and is called on application startup.

Specified by:
contextInitialized in interface javax.servlet.ServletContextListener

contextDestroyed

public void contextDestroyed(javax.servlet.ServletContextEvent sce)
Deprecated. 
Currently does nothing. In the future it should close down any database connections if they wheren't obtained via JNDI. This method is a part of ServletContextListener interface and is called on application shutdown.

Specified by:
contextDestroyed in interface javax.servlet.ServletContextListener

sessionCreated

public void sessionCreated(javax.servlet.http.HttpSessionEvent se)
Deprecated. 
Creates and assigns a new data context based on default domain to the session object associated with this event. This method is a part of HttpSessionListener interface and is called every time when a new session is created.

Specified by:
sessionCreated in interface javax.servlet.http.HttpSessionListener

sessionDestroyed

public void sessionDestroyed(javax.servlet.http.HttpSessionEvent se)
Deprecated. 
Does nothing. This method is a part of HttpSessionListener interface and is called every time when a session is destroyed.

Specified by:
sessionDestroyed in interface javax.servlet.http.HttpSessionListener

newConfiguration

protected Configuration newConfiguration(javax.servlet.ServletContext sc)
Deprecated. since 1.2

Returns an instance of Configuration that will be initialized as the shared configuration. Provides an extension point for the developer to provide their own custom configuration.


setConfiguration

protected void setConfiguration(Configuration configuration)
Deprecated. 
Initializes the configuration.


getConfiguration

protected Configuration getConfiguration()
Deprecated. 
Returns the current configuration.



Copyright © 2001-2006 Apache.org All Rights Reserved.