org.directwebremoting.guice
Class DwrGuiceServletContextListener

java.lang.Object
  extended by com.google.inject.AbstractModule
      extended by org.directwebremoting.guice.AbstractDwrModule
          extended by org.directwebremoting.guice.DwrGuiceServletContextListener
All Implemented Interfaces:
com.google.inject.Module, java.util.EventListener, javax.servlet.ServletContextListener

public abstract class DwrGuiceServletContextListener
extends AbstractDwrModule
implements javax.servlet.ServletContextListener

Register a concrete subclass of this as a servlet context listener to configure an Injector and stash it in the ServletContext.

Author:
Tim Peierls [tim at peierls dot net]

Constructor Summary
DwrGuiceServletContextListener()
           
 
Method Summary
protected abstract  void configure()
          Define this method to configure bindings at servlet context initialization.
 void contextDestroyed(javax.servlet.ServletContextEvent servletContextEvent)
           
 void contextInitialized(javax.servlet.ServletContextEvent servletContextEvent)
           
protected  javax.servlet.ServletContext getServletContext()
          Subclasses can use this during stage determination and binding to read values from the current servlet context.
protected  com.google.inject.Stage getStage()
          Override this method to specify which stage to run Guice in.
 
Methods inherited from class org.directwebremoting.guice.AbstractDwrModule
bindAnnotatedClasses, bindConversion, bindConversion, bindConversion, bindDwrScopes, bindDwrScopes, bindFilter, bindGlobalFilter, bindParameter, bindRemoted, bindRemotedAs
 
Methods inherited from class com.google.inject.AbstractModule
addError, addError, bind, bind, bind, bindConstant, binder, bindInterceptor, bindScope, configure, install, requestStaticInjection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DwrGuiceServletContextListener

public DwrGuiceServletContextListener()
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

configure

protected abstract void configure()
Define this method to configure bindings at servlet context initialization. Call AbstractModule.install(Module) within this method to use binding code from other modules.

Specified by:
configure in class AbstractDwrModule

getStage

protected com.google.inject.Stage getStage()
Override this method to specify which stage to run Guice in. Default behavior is to look first in user preferences and then in system preferences for node "org/directwebremoting/guice" with a value for key "stage". If not found, the default is Stage.PRODUCTION.


getServletContext

protected javax.servlet.ServletContext getServletContext()
Subclasses can use this during stage determination and binding to read values from the current servlet context.



Copyright © 2007. All Rights Reserved.