felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1687565 - in /felix/trunk/http: bridge/pom.xml proxy/pom.xml proxy/src/main/java/org/apache/felix/http/proxy/ProxyListener.java
Date Thu, 25 Jun 2015 15:55:38 GMT
Author: cziegeler
Date: Thu Jun 25 15:55:37 2015
New Revision: 1687565

URL: http://svn.apache.org/r1687565
Log:
FELIX-4939 : Add support for http session id listener

Modified:
    felix/trunk/http/bridge/pom.xml
    felix/trunk/http/proxy/pom.xml
    felix/trunk/http/proxy/src/main/java/org/apache/felix/http/proxy/ProxyListener.java

Modified: felix/trunk/http/bridge/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/http/bridge/pom.xml?rev=1687565&r1=1687564&r2=1687565&view=diff
==============================================================================
--- felix/trunk/http/bridge/pom.xml (original)
+++ felix/trunk/http/bridge/pom.xml Thu Jun 25 15:55:37 2015
@@ -28,7 +28,7 @@
 
     <name>Apache Felix Http Bridge</name>
     <artifactId>org.apache.felix.http.bridge</artifactId>
-    <version>2.4.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
     <packaging>jar</packaging>
 
     <scm>

Modified: felix/trunk/http/proxy/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/http/proxy/pom.xml?rev=1687565&r1=1687564&r2=1687565&view=diff
==============================================================================
--- felix/trunk/http/proxy/pom.xml (original)
+++ felix/trunk/http/proxy/pom.xml Thu Jun 25 15:55:37 2015
@@ -28,7 +28,7 @@
 
     <name>Apache Felix Http Proxy</name>
     <artifactId>org.apache.felix.http.proxy</artifactId>
-    <version>2.3.3-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
     <packaging>jar</packaging>
 
     <scm>
@@ -45,7 +45,7 @@
                 <configuration>
                     <instructions>
                         <Export-Package>
-                            org.apache.felix.http.proxy;version=2.1.0
+                            org.apache.felix.http.proxy
                         </Export-Package>
                     </instructions>
                 </configuration>

Modified: felix/trunk/http/proxy/src/main/java/org/apache/felix/http/proxy/ProxyListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/proxy/src/main/java/org/apache/felix/http/proxy/ProxyListener.java?rev=1687565&r1=1687564&r2=1687565&view=diff
==============================================================================
--- felix/trunk/http/proxy/src/main/java/org/apache/felix/http/proxy/ProxyListener.java (original)
+++ felix/trunk/http/proxy/src/main/java/org/apache/felix/http/proxy/ProxyListener.java Thu
Jun 25 15:55:37 2015
@@ -26,6 +26,7 @@ import javax.servlet.ServletContextListe
 import javax.servlet.http.HttpSessionAttributeListener;
 import javax.servlet.http.HttpSessionBindingEvent;
 import javax.servlet.http.HttpSessionEvent;
+import javax.servlet.http.HttpSessionIdListener;
 import javax.servlet.http.HttpSessionListener;
 
 import org.osgi.framework.BundleContext;
@@ -42,7 +43,11 @@ import org.osgi.util.tracker.ServiceTrac
  *
  * @since 2.1.0
  */
-public class ProxyListener implements HttpSessionAttributeListener, HttpSessionListener,
ServletContextListener
+public class ProxyListener
+    implements HttpSessionAttributeListener,
+               HttpSessionListener,
+               HttpSessionIdListener,
+               ServletContextListener
 {
 
     private ServletContext servletContext;
@@ -51,15 +56,19 @@ public class ProxyListener implements Ht
 
     private HttpSessionListener sessionDispatcher;
 
+    private HttpSessionIdListener sessionIdDispatcher;
+
     private HttpSessionAttributeListener attributeDispatcher;
 
     // ---------- ServletContextListener
 
+    @Override
     public void contextInitialized(final ServletContextEvent sce)
     {
         this.servletContext = sce.getServletContext();
     }
 
+    @Override
     public void contextDestroyed(final ServletContextEvent sce)
     {
         if (this.eventDispatcherTracker != null)
@@ -72,6 +81,7 @@ public class ProxyListener implements Ht
 
     // ---------- HttpSessionListener
 
+    @Override
     public void sessionCreated(final HttpSessionEvent se)
     {
         final HttpSessionListener sessionDispatcher = getSessionDispatcher();
@@ -81,6 +91,7 @@ public class ProxyListener implements Ht
         }
     }
 
+    @Override
     public void sessionDestroyed(final HttpSessionEvent se)
     {
         final HttpSessionListener sessionDispatcher = getSessionDispatcher();
@@ -90,8 +101,21 @@ public class ProxyListener implements Ht
         }
     }
 
+    // ---------- HttpSessionIdListener
+
+    @Override
+    public void sessionIdChanged(final HttpSessionEvent event, final String oldSessionId)
+    {
+        final HttpSessionIdListener sessionIdDispatcher = getSessionIdDispatcher();
+        if (sessionIdDispatcher != null)
+        {
+            sessionIdDispatcher.sessionIdChanged(event, oldSessionId);
+        }
+    }
+
     // ---------- HttpSessionAttributeListener
 
+    @Override
     public void attributeAdded(final HttpSessionBindingEvent se)
     {
         final HttpSessionAttributeListener attributeDispatcher = getAttributeDispatcher();
@@ -101,6 +125,7 @@ public class ProxyListener implements Ht
         }
     }
 
+    @Override
     public void attributeRemoved(final HttpSessionBindingEvent se)
     {
         final HttpSessionAttributeListener attributeDispatcher = getAttributeDispatcher();
@@ -110,6 +135,7 @@ public class ProxyListener implements Ht
         }
     }
 
+    @Override
     public void attributeReplaced(final HttpSessionBindingEvent se)
     {
         final HttpSessionAttributeListener attributeDispatcher = getAttributeDispatcher();
@@ -139,10 +165,12 @@ public class ProxyListener implements Ht
                 Filter filter = createFilter(bundleContext, null);
                 this.eventDispatcherTracker = new ServiceTracker(bundleContext, filter, null)
                 {
+                    @Override
                     public void removedService(ServiceReference reference, Object service)
                     {
                         ProxyListener.this.sessionDispatcher = null;
                         ProxyListener.this.attributeDispatcher = null;
+                        ProxyListener.this.sessionIdDispatcher = null;
                         super.removedService(reference, service);
                     }
                 };
@@ -170,6 +198,19 @@ public class ProxyListener implements Ht
         return this.sessionDispatcher;
     }
 
+    private HttpSessionIdListener getSessionIdDispatcher()
+    {
+        if (this.sessionIdDispatcher == null)
+        {
+            final Object dispatcher = getDispatcher();
+            if (dispatcher instanceof HttpSessionIdListener)
+            {
+                this.sessionIdDispatcher = (HttpSessionIdListener) dispatcher;
+            }
+        }
+        return this.sessionIdDispatcher;
+    }
+
     private HttpSessionAttributeListener getAttributeDispatcher()
     {
         if (this.attributeDispatcher == null)



Mime
View raw message