diff --git a/jetty-cdi/cdi-servlet/src/main/java/org/eclipse/jetty/cdi/servlet/EmbeddedCdiHandler.java b/jetty-cdi/cdi-servlet/src/main/java/org/eclipse/jetty/cdi/servlet/EmbeddedCdiHandler.java index 612eb5874aa..01142158b2a 100644 --- a/jetty-cdi/cdi-servlet/src/main/java/org/eclipse/jetty/cdi/servlet/EmbeddedCdiHandler.java +++ b/jetty-cdi/cdi-servlet/src/main/java/org/eclipse/jetty/cdi/servlet/EmbeddedCdiHandler.java @@ -23,6 +23,11 @@ import java.util.Collections; import java.util.Set; import javax.servlet.ServletContext; +import javax.servlet.http.HttpSessionActivationListener; +import javax.servlet.http.HttpSessionAttributeListener; +import javax.servlet.http.HttpSessionBindingListener; +import javax.servlet.http.HttpSessionIdListener; +import javax.servlet.http.HttpSessionListener; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.util.log.Log; @@ -119,6 +124,14 @@ public class EmbeddedCdiHandler extends ServletContextHandler // add the rest of the Weld Listeners ctx.addListener(weldListener); + if ((weldListener instanceof HttpSessionActivationListener) + || (weldListener instanceof HttpSessionAttributeListener) + || (weldListener instanceof HttpSessionBindingListener) + || (weldListener instanceof HttpSessionListener) + || (weldListener instanceof HttpSessionIdListener)) + { + getSessionHandler().addEventListener(weldListener); + } } finally {