Author: dhanji
Date: Sat Mar 21 03:34:16 2009
New Revision: 909

Modified:
     
trunk/servlet/src/com/google/inject/servlet/GuiceServletContextListener.java

Log:
Added support for early access to the Servlet conteext. See issue 348

Modified:  
trunk/servlet/src/com/google/inject/servlet/GuiceServletContextListener.java
==============================================================================
---  
trunk/servlet/src/com/google/inject/servlet/GuiceServletContextListener.java    
 
(original)
+++  
trunk/servlet/src/com/google/inject/servlet/GuiceServletContextListener.java    
 
Sat Mar 21 03:34:16 2009
@@ -17,6 +17,7 @@
  package com.google.inject.servlet;

  import com.google.inject.Injector;
+import java.lang.ref.WeakReference;
  import javax.servlet.ServletContext;
  import javax.servlet.ServletContextEvent;
  import javax.servlet.ServletContextListener;
@@ -37,6 +38,9 @@
    public void contextInitialized(ServletContextEvent servletContextEvent) {
      ServletContext servletContext =  
servletContextEvent.getServletContext();
      servletContext.setAttribute(INJECTOR_NAME, getInjector());
+
+    // Set the Servletcontext early for those people who are using this  
class.
+    GuiceFilter.servletContext = new  
WeakReference<ServletContext>(servletContext);
    }

    public void contextDestroyed(ServletContextEvent servletContextEvent) {

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" 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-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to