Class Listener
- java.lang.Object
-
- org.jboss.weld.servlet.api.helpers.ForwardingServletListener
-
- org.jboss.weld.environment.servlet.Listener
-
- All Implemented Interfaces:
jakarta.servlet.http.HttpSessionListener,jakarta.servlet.ServletContextListener,jakarta.servlet.ServletRequestListener,EventListener,org.jboss.weld.servlet.api.ServletListener
public class Listener extends org.jboss.weld.servlet.api.helpers.ForwardingServletListenerThis is the original listener which had to be defined in web.xml. It's not necessary to register this listener in Servlet 3.0 compliant containers unless there are listener ordering conflicts. E.g. if a user provides a custom listener the request context will not be active during its notifications. In this case place this listener before any other listener definitions in web.xml.ServletContextListener.contextInitialized(ServletContextEvent)is no-op in case of theEnhancedListeneris registered as well.- Author:
- Pete Muir, Ales Justin
- See Also:
EnhancedListener
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONTAINER_ATTRIBUTE_NAME
-
Constructor Summary
Constructors Constructor Description Listener()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcontextDestroyed(jakarta.servlet.ServletContextEvent sce)voidcontextInitialized(jakarta.servlet.ServletContextEvent sce)protected org.jboss.weld.servlet.api.ServletListenerdelegate()voidrequestDestroyed(jakarta.servlet.ServletRequestEvent sre)voidrequestInitialized(jakarta.servlet.ServletRequestEvent sre)voidsessionCreated(jakarta.servlet.http.HttpSessionEvent se)voidsessionDestroyed(jakarta.servlet.http.HttpSessionEvent se)static Listenerusing(jakarta.enterprise.inject.spi.BeanManager manager)Creates a new Listener that uses the givenBeanManagerinstead of initializing a new Weld container instance.static Listenerusing(org.jboss.weld.environment.ContainerInstance container)Creates a new Listener that uses the givenContainerInstance(e.g.static Listenerusing(org.jboss.weld.environment.ContainerInstanceFactory container)Creates a new Listener that uses the givenContainerInstanceFactoryfor initializing Weld instance.
-
-
-
Field Detail
-
CONTAINER_ATTRIBUTE_NAME
public static final String CONTAINER_ATTRIBUTE_NAME
-
-
Method Detail
-
using
public static Listener using(jakarta.enterprise.inject.spi.BeanManager manager)
Creates a new Listener that uses the givenBeanManagerinstead of initializing a new Weld container instance.- Parameters:
manager- the bean manager to be used- Returns:
- a new Listener instance
-
using
public static Listener using(org.jboss.weld.environment.ContainerInstance container)
Creates a new Listener that uses the givenContainerInstance(e.g.org.jboss.weld.environment.se.WeldContainer) instead of initializing a new Weld container instance. The listener does not take over the responsibility for container instance lifecycle management. It is the caller's responsibility to shut down the container instance properly. The listener will not shut down the container instance when the Servlet context is destroyed.- Parameters:
container- the container instance to be used- Returns:
- a new Listener instance
-
using
public static Listener using(org.jboss.weld.environment.ContainerInstanceFactory container)
Creates a new Listener that uses the givenContainerInstanceFactoryfor initializing Weld instance. A new Weld instance will be initialized usingContainerInstanceFactory.initialize()when the Servlet context is initialized. The Weld instance will be shut down when Servlet context is destroyed.- Parameters:
container- the container factory to be used- Returns:
- a new Listener instance
-
contextInitialized
public void contextInitialized(jakarta.servlet.ServletContextEvent sce)
- Specified by:
contextInitializedin interfacejakarta.servlet.ServletContextListener- Overrides:
contextInitializedin classorg.jboss.weld.servlet.api.helpers.ForwardingServletListener
-
contextDestroyed
public void contextDestroyed(jakarta.servlet.ServletContextEvent sce)
- Specified by:
contextDestroyedin interfacejakarta.servlet.ServletContextListener- Overrides:
contextDestroyedin classorg.jboss.weld.servlet.api.helpers.ForwardingServletListener
-
requestDestroyed
public void requestDestroyed(jakarta.servlet.ServletRequestEvent sre)
- Specified by:
requestDestroyedin interfacejakarta.servlet.ServletRequestListener- Overrides:
requestDestroyedin classorg.jboss.weld.servlet.api.helpers.ForwardingServletListener
-
requestInitialized
public void requestInitialized(jakarta.servlet.ServletRequestEvent sre)
- Specified by:
requestInitializedin interfacejakarta.servlet.ServletRequestListener- Overrides:
requestInitializedin classorg.jboss.weld.servlet.api.helpers.ForwardingServletListener
-
sessionCreated
public void sessionCreated(jakarta.servlet.http.HttpSessionEvent se)
- Specified by:
sessionCreatedin interfacejakarta.servlet.http.HttpSessionListener- Overrides:
sessionCreatedin classorg.jboss.weld.servlet.api.helpers.ForwardingServletListener
-
sessionDestroyed
public void sessionDestroyed(jakarta.servlet.http.HttpSessionEvent se)
- Specified by:
sessionDestroyedin interfacejakarta.servlet.http.HttpSessionListener- Overrides:
sessionDestroyedin classorg.jboss.weld.servlet.api.helpers.ForwardingServletListener
-
delegate
protected org.jboss.weld.servlet.api.ServletListener delegate()
- Specified by:
delegatein classorg.jboss.weld.servlet.api.helpers.ForwardingServletListener
-
-