org.nanocontainer.nanowar
Class NanoWarSessionListener

java.lang.Object
  extended by org.nanocontainer.nanowar.AbstractNanoWarListener
      extended by org.nanocontainer.nanowar.NanoWarSessionListener
All Implemented Interfaces:
Serializable, EventListener, javax.servlet.http.HttpSessionListener, KeyConstants

public class NanoWarSessionListener
extends AbstractNanoWarListener
implements javax.servlet.http.HttpSessionListener, KeyConstants

Servlet listener class that hooks into the underlying servlet container and instantiates, assembles, starts, stores and disposes the appropriate pico containers when sessions start/stop.

To use, simply add as a listener to web.xml the listener-class org.nanocontainer.nanowar.NanoWarSessionListener.

The containers are configured via context-params in web.xml, in two ways:

  1. A NanoContainer script via a parameter whose name is nanocontainer., where is one of the supported scripting languages, see ScriptedContainerBuilderFactory. The parameter value can be either an inlined script (enclosed in ), or a resource path for the script (relative to the webapp context).
  2. A ContainerComposer class via the parameter name CONTAINER_COMPOSER, which can be configured via an optional parameter CONTAINER_COMPOSER_CONFIGURATION.

Note: if one is interested in both application-scoped and session-scoped components, the org.nanocontainer.nanowar.ServletContainerLister should be configured in the web.xml.

Warning: session-level containers can be problematic on many fronts including persisted sessions, clustering, etc.

Author:
Michael Rimov, Joe Walnes, Aslak Hellesøy, Philipp Meier, Paul Hammant, Mauro Talevi, Konstantin Pribluda
See Also:
NanoWarContextListener, ServletContainerListener, Serialized Form

Field Summary
 
Fields inherited from interface org.nanocontainer.nanowar.KeyConstants
ACTIONS_CONTAINER, APPLICATION_CONTAINER, BUILDER, CONTAINER_COMPOSER, CONTAINER_COMPOSER_CONFIGURATION, KILLER_HELPER, NANOCONTAINER_PREFIX, REQUEST_CONTAINER, SESSION_CONTAINER
 
Constructor Summary
NanoWarSessionListener()
           
 
Method Summary
 void sessionCreated(javax.servlet.http.HttpSessionEvent event)
           
 void sessionDestroyed(javax.servlet.http.HttpSessionEvent se)
           
 
Methods inherited from class org.nanocontainer.nanowar.AbstractNanoWarListener
buildContainer, killContainer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NanoWarSessionListener

public NanoWarSessionListener()
Method Detail

sessionCreated

public void sessionCreated(javax.servlet.http.HttpSessionEvent event)
Specified by:
sessionCreated in interface javax.servlet.http.HttpSessionListener

sessionDestroyed

public void sessionDestroyed(javax.servlet.http.HttpSessionEvent se)
Specified by:
sessionDestroyed in interface javax.servlet.http.HttpSessionListener


Copyright © 2003-2009 Codehaus. All Rights Reserved.