FELIX-1962 Add the EventDispatcher from the Http Base bundle as listener into Jetty to allow Jetty to send events to the registered listener services
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1057096 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyActivator.java b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyActivator.java
index 0778de9..2831627 100644
--- a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyActivator.java
+++ b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyActivator.java
@@ -19,7 +19,7 @@
import org.apache.felix.http.base.internal.AbstractHttpActivator;
public final class JettyActivator
- extends AbstractHttpActivator
+ extends AbstractHttpActivator
{
private JettyService jetty;
@@ -27,7 +27,8 @@
throws Exception
{
super.doStart();
- this.jetty = new JettyService(getBundleContext(), getDispatcherServlet(), getHttpServiceController());
+ this.jetty = new JettyService(getBundleContext(), getDispatcherServlet(), getEventDispatcher(),
+ getHttpServiceController());
this.jetty.start();
}
diff --git a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
index 9181ea6..8c4a4af 100644
--- a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
+++ b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
@@ -28,6 +28,7 @@
import org.mortbay.jetty.nio.SelectChannelConnector;
import org.mortbay.jetty.servlet.*;
import org.apache.felix.http.base.internal.DispatcherServlet;
+import org.apache.felix.http.base.internal.EventDispatcher;
import org.apache.felix.http.base.internal.HttpServiceController;
import org.apache.felix.http.base.internal.logger.SystemLogger;
@@ -48,13 +49,16 @@
private ServiceRegistration configServiceReg;
private Server server;
private DispatcherServlet dispatcher;
+ private EventDispatcher eventDispatcher;
private final HttpServiceController controller;
- public JettyService(BundleContext context, DispatcherServlet dispatcher, HttpServiceController controller)
+ public JettyService(BundleContext context, DispatcherServlet dispatcher, EventDispatcher eventDispatcher,
+ HttpServiceController controller)
{
this.context = context;
this.config = new JettyConfig(this.context);
this.dispatcher = dispatcher;
+ this.eventDispatcher = eventDispatcher;
this.controller = controller;
}
@@ -153,6 +157,8 @@
}
Context context = new Context(this.server, "/", Context.SESSIONS);
+ context.addEventListener(eventDispatcher);
+ context.getSessionHandler().addEventListener(eventDispatcher);
context.addServlet(new ServletHolder(this.dispatcher), "/*");
this.server.start();