[seam-commits] Seam SVN: r12249 - modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/event.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Mar 23 05:10:18 EDT 2010


Author: nickarls
Date: 2010-03-23 05:10:17 -0400 (Tue, 23 Mar 2010)
New Revision: 12249

Modified:
   modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/event/HttpManager.java
   modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/event/ServletListener.java
Log:
some logging

Modified: modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/event/HttpManager.java
===================================================================
--- modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/event/HttpManager.java	2010-03-23 09:03:33 UTC (rev 12248)
+++ modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/event/HttpManager.java	2010-03-23 09:10:17 UTC (rev 12249)
@@ -3,6 +3,7 @@
 import javax.enterprise.context.SessionScoped;
 import javax.enterprise.event.Observes;
 import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
 import javax.servlet.ServletContextAttributeEvent;
 import javax.servlet.ServletRequestEvent;
 import javax.servlet.http.HttpServletRequest;
@@ -15,6 +16,7 @@
 import org.jboss.seam.servlet.event.qualifier.Created;
 import org.jboss.seam.servlet.event.qualifier.Destroyed;
 import org.jboss.seam.servlet.event.qualifier.Initialized;
+import org.slf4j.Logger;
 
 /**
  * A manager for acquiring HTTP artifacts
@@ -29,13 +31,18 @@
    private HttpServletRequest request;
    private BeanManager beanManager;
 
+   @Inject
+   private Logger log;
+
    protected void requestInitialized(@Observes @Initialized ServletRequestEvent e)
    {
+      log.trace("Servlet request initialized with event #0", e);
       request = (HttpServletRequest) e.getServletRequest();
    }
 
    protected void requestDestroyed(@Observes @Destroyed ServletRequestEvent e)
    {
+      log.trace("Servlet request destroyed with event #0", e);
       request = null;
    }
 
@@ -43,6 +50,7 @@
    {
       if (BeanManager.class.getName().equals(e.getName()))
       {
+         log.trace("Bean manager set in servlet context with event #0", e);
          beanManager = (BeanManager) e.getValue();
       }
    }
@@ -51,6 +59,7 @@
    {
       if (BeanManager.class.getName().equals(e.getName()))
       {
+         log.trace("Bean manager replaced in servlet context with event #0", e);
          beanManager = (BeanManager) e.getValue();
       }
    }
@@ -59,17 +68,20 @@
    {
       if (BeanManager.class.getName().equals(e.getName()))
       {
+         log.trace("Bean manager removed from servlet context with event #0", e);
          beanManager = null;
       }
    }
 
    protected void sessionInitialized(@Observes @Created HttpSessionEvent e)
    {
+      log.trace("HTTP session initalized with event #0", e);
       session = e.getSession();
    }
 
    protected void sessionDestroyed(@Observes @Destroyed HttpSessionEvent e)
    {
+      log.trace("HTTP session destroyed with event #0", e);
       session = null;
    }
 

Modified: modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/event/ServletListener.java
===================================================================
--- modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/event/ServletListener.java	2010-03-23 09:03:33 UTC (rev 12248)
+++ modules/servlet/trunk/src/main/java/org/jboss/seam/servlet/event/ServletListener.java	2010-03-23 09:10:17 UTC (rev 12249)
@@ -42,6 +42,7 @@
 import org.jboss.seam.servlet.event.qualifier.ValueBound;
 import org.jboss.seam.servlet.event.qualifier.ValueUnbound;
 import org.jboss.seam.servlet.event.qualifier.WillPassivate;
+import org.slf4j.Logger;
 
 /**
  * A self-registering web-listener that propagates the events to the current CDI
@@ -55,6 +56,9 @@
 {
    @Inject
    private BeanManager beanManager;
+   
+   @Inject
+   private Logger log;
 
    // FIXME: hack to work around invalid binding in JBoss AS 6 M2
    private static final List<String> beanManagerLocations = new ArrayList<String>()
@@ -80,11 +84,13 @@
       {
          try
          {
+            log.trace("Looking for Bean Manager at JNDI location #0", location);
             return (BeanManager) new InitialContext().lookup(location);
          }
          catch (NamingException e)
          {
             // No panic, keep trying
+            log.debug("Bean Manager not found at JNDI location #0", location);
          }
       }
       // OK, panic
@@ -93,7 +99,7 @@
 
    private void fireEvent(Object payload, Annotation... qualifiers)
    {
-      System.out.println("Fired event " + payload + " with " + qualifiers);
+      log.trace("Firing event #0 with qualifiers #1", payload, qualifiers);
       beanManager.fireEvent(payload, qualifiers);
    }
 
@@ -133,10 +139,6 @@
    {
       fireEvent(e, new AnnotationLiteral<AttributeRemoved>()
       {
-
-         /**
-          * 
-          */
          private static final long serialVersionUID = 1L;
       });
    }



More information about the seam-commits mailing list