That's the source code for GuiceServletContextListener:
public abstract class GuiceServletContextListener
implements ServletContextListener {
static final String INJECTOR_NAME = Injector.class.getName();
public void contextInitialized(ServletContextEvent servletContextEvent) {
final ServletContext servletContext =
servletContextEvent.getServletContext();
// Set the Servletcontext early for those people who are using this
class.
// NOTE(dhanji): This use of the servletContext is deprecated.
GuiceFilter.servletContext = new
WeakReference<ServletContext>(servletContext);
Injector injector = getInjector();
injector.getInstance(InternalServletModule.BackwardsCompatibleServletContextProvider.class)
.set(servletContext);
servletContext.setAttribute(INJECTOR_NAME, injector);
}
public void contextDestroyed(ServletContextEvent servletContextEvent) {
ServletContext servletContext = servletContextEvent.getServletContext();
servletContext.removeAttribute(INJECTOR_NAME);
}
/**
* Override this method to create (or otherwise obtain a reference to)
your
* injector.
*/
protected abstract Injector getInjector();
}
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-guice?hl=en.