cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r548970 - /cocoon/trunk/tools/cocoon-maven-plugin/src/main/java/org/apache/cocoon/maven/deployer/servlet/ShieldingListener.java
Date Wed, 20 Jun 2007 07:55:15 GMT
Author: reinhard
Date: Wed Jun 20 00:55:14 2007
New Revision: 548970

URL: http://svn.apache.org/viewvc?view=rev&rev=548970
Log:
- support ServletRequestListener

Modified:
    cocoon/trunk/tools/cocoon-maven-plugin/src/main/java/org/apache/cocoon/maven/deployer/servlet/ShieldingListener.java

Modified: cocoon/trunk/tools/cocoon-maven-plugin/src/main/java/org/apache/cocoon/maven/deployer/servlet/ShieldingListener.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-maven-plugin/src/main/java/org/apache/cocoon/maven/deployer/servlet/ShieldingListener.java?view=diff&rev=548970&r1=548969&r2=548970
==============================================================================
--- cocoon/trunk/tools/cocoon-maven-plugin/src/main/java/org/apache/cocoon/maven/deployer/servlet/ShieldingListener.java
(original)
+++ cocoon/trunk/tools/cocoon-maven-plugin/src/main/java/org/apache/cocoon/maven/deployer/servlet/ShieldingListener.java
Wed Jun 20 00:55:14 2007
@@ -27,6 +27,8 @@
 import javax.servlet.ServletContextEvent;
 import javax.servlet.ServletContextListener;
 import javax.servlet.ServletException;
+import javax.servlet.ServletRequestEvent;
+import javax.servlet.ServletRequestListener;
 import javax.servlet.http.HttpSessionActivationListener;
 import javax.servlet.http.HttpSessionAttributeListener;
 import javax.servlet.http.HttpSessionBindingEvent;
@@ -46,7 +48,8 @@
                HttpSessionActivationListener,
                HttpSessionAttributeListener,
                HttpSessionBindingListener,
-               ServletContextAttributeListener {
+               ServletContextAttributeListener,
+               ServletRequestListener {
 
     private static final String SERVLET_CONTEXT_CREATED = "CLC";
 
@@ -76,6 +79,10 @@
 
     private static final String CONTEXT_ATTR_ADDED = "CAAD";
 
+    private static final String REQUEST_DESTROYED = "RD";
+
+    private static final String REQUEST_INITIALIZED = "RI";
+
     protected ClassLoader classloader;
 
     protected List httpSessionListeners = new ArrayList();
@@ -90,6 +97,8 @@
 
     protected List httpSessionAttributeListeners = new ArrayList();
 
+    protected List servletRequestListeners = new ArrayList();
+
     protected void init(ServletContext context) {
         // Get the classloader
         try {
@@ -129,6 +138,9 @@
                         if ( listener instanceof ServletContextAttributeListener ) {
                             this.servletContextAttributeListeners.add(listener);
                         }
+                        if ( listener instanceof ServletRequestListener ) {
+                            this.servletRequestListeners.add(listener);
+                        }
                     } catch (Exception e) {
                         throw new RuntimeException("Cannot load listener " + className, e);
                     }
@@ -151,31 +163,35 @@
                         if ( ShieldingListener.SERVLET_CONTEXT_CREATED.equals(identifier)
) {
                             ((ServletContextListener)listener).contextInitialized((ServletContextEvent)event);
                         } else if ( ShieldingListener.SERVLET_CONTEXT_DESTROYED.equals(identifier)
) {
-                            ((ServletContextListener)listener).contextDestroyed((ServletContextEvent)event);
                           
+                            ((ServletContextListener)listener).contextDestroyed((ServletContextEvent)event);
                         } else if ( ShieldingListener.SESSION_CREATED.equals(identifier)
) {
-                            ((HttpSessionListener)listener).sessionCreated((HttpSessionEvent)event);
                           
+                            ((HttpSessionListener)listener).sessionCreated((HttpSessionEvent)event);
                         } else if ( ShieldingListener.SESSION_DESTROYED.equals(identifier)
) {
-                            ((HttpSessionListener)listener).sessionDestroyed((HttpSessionEvent)event);
                           
+                            ((HttpSessionListener)listener).sessionDestroyed((HttpSessionEvent)event);
                         } else if ( ShieldingListener.VALUE_BOUND.equals(identifier) ) {
-                            ((HttpSessionBindingListener)listener).valueBound((HttpSessionBindingEvent)event);
                           
+                            ((HttpSessionBindingListener)listener).valueBound((HttpSessionBindingEvent)event);
                         } else if ( ShieldingListener.VALUE_UNBOUND.equals(identifier) )
{
-                            ((HttpSessionBindingListener)listener).valueUnbound((HttpSessionBindingEvent)event);
                           
+                            ((HttpSessionBindingListener)listener).valueUnbound((HttpSessionBindingEvent)event);
                         } else if ( ShieldingListener.ATTR_ADDED.equals(identifier) ) {
-                            ((HttpSessionAttributeListener)listener).attributeAdded((HttpSessionBindingEvent)event);
                           
+                            ((HttpSessionAttributeListener)listener).attributeAdded((HttpSessionBindingEvent)event);
                         } else if ( ShieldingListener.ATTR_REMOVED.equals(identifier) ) {
-                            ((HttpSessionAttributeListener)listener).attributeRemoved((HttpSessionBindingEvent)event);
                           
+                            ((HttpSessionAttributeListener)listener).attributeRemoved((HttpSessionBindingEvent)event);
                         } else if ( ShieldingListener.ATTR_REPLACED.equals(identifier) )
{
-                            ((HttpSessionAttributeListener)listener).attributeReplaced((HttpSessionBindingEvent)event);
                           
+                            ((HttpSessionAttributeListener)listener).attributeReplaced((HttpSessionBindingEvent)event);
                         } else if ( ShieldingListener.CONTEXT_ATTR_ADDED.equals(identifier)
) {
-                            ((ServletContextAttributeListener)listener).attributeAdded((ServletContextAttributeEvent)event);
                           
+                            ((ServletContextAttributeListener)listener).attributeAdded((ServletContextAttributeEvent)event);
                         } else if ( ShieldingListener.CONTEXT_ATTR_REMOVED.equals(identifier)
) {
-                            ((ServletContextAttributeListener)listener).attributeRemoved((ServletContextAttributeEvent)event);
                           
+                            ((ServletContextAttributeListener)listener).attributeRemoved((ServletContextAttributeEvent)event);
                         } else if ( ShieldingListener.CONTEXT_ATTR_REPLACED.equals(identifier)
) {
-                            ((ServletContextAttributeListener)listener).attributeReplaced((ServletContextAttributeEvent)event);
                           
+                            ((ServletContextAttributeListener)listener).attributeReplaced((ServletContextAttributeEvent)event);
                         } else if ( ShieldingListener.SESSION_ACTIVATED.equals(identifier)
) {
-                            ((HttpSessionActivationListener)listener).sessionDidActivate((HttpSessionEvent)event);
                           
+                            ((HttpSessionActivationListener)listener).sessionDidActivate((HttpSessionEvent)event);
                         } else if ( ShieldingListener.SESSION_PASSIVATE.equals(identifier)
) {
-                            ((HttpSessionActivationListener)listener).sessionWillPassivate((HttpSessionEvent)event);
                           
+                            ((HttpSessionActivationListener)listener).sessionWillPassivate((HttpSessionEvent)event);
+                        } else if ( ShieldingListener.REQUEST_DESTROYED.equals(identifier)
) {
+                            ((ServletRequestListener)listener).requestDestroyed((ServletRequestEvent)event);
+                        } else if ( ShieldingListener.REQUEST_INITIALIZED.equals(identifier)
) {
+                            ((ServletRequestListener)listener).requestInitialized((ServletRequestEvent)event);
                         }
                     } catch (Exception e) {
                         throw new RuntimeException("Cannot invoke listener " + listener,
e);
@@ -203,7 +219,7 @@
 
         this.invoke(this.servletContextListeners, ShieldingListener.SERVLET_CONTEXT_CREATED,
contextEvent);
     }
-    
+
     /**
      * @see javax.servlet.http.HttpSessionListener#sessionCreated(javax.servlet.http.HttpSessionEvent)
      */
@@ -286,5 +302,19 @@
      */
     public void attributeReplaced(ServletContextAttributeEvent event) {
         this.invoke(this.servletContextAttributeListeners, ShieldingListener.CONTEXT_ATTR_REPLACED,
event);
+    }
+
+    /**
+     * @see javax.servlet.ServletRequestListener#requestDestroyed(javax.servlet.ServletRequestEvent)
+     */
+    public void requestDestroyed(ServletRequestEvent event) {
+        this.invoke(this.servletRequestListeners, ShieldingListener.REQUEST_DESTROYED, event);
+    }
+
+    /**
+     * @see javax.servlet.ServletRequestListener#requestInitialized(javax.servlet.ServletRequestEvent)
+     */
+    public void requestInitialized(ServletRequestEvent event) {
+        this.invoke(this.servletRequestListeners, ShieldingListener.REQUEST_INITIALIZED,
event);
     }
 }



Mime
View raw message