Search in sources :

Example 16 with ListenerInfo

use of io.undertow.servlet.api.ListenerInfo in project wildfly by wildfly.

the class UndertowDeploymentInfoService method addListener.

private static void addListener(final ClassLoader classLoader, final ComponentRegistry components, final DeploymentInfo d, final ListenerMetaData listener) throws ClassNotFoundException {
    ListenerInfo l;
    final Class<? extends EventListener> listenerClass = (Class<? extends EventListener>) classLoader.loadClass(listener.getListenerClass());
    ManagedReferenceFactory creator = components.createInstanceFactory(listenerClass);
    if (creator != null) {
        InstanceFactory<EventListener> factory = createInstanceFactory(creator);
        l = new ListenerInfo(listenerClass, factory);
    } else {
        l = new ListenerInfo(listenerClass);
    }
    d.addListener(l);
}
Also used : ListenerInfo(io.undertow.servlet.api.ListenerInfo) ManagedReferenceFactory(org.jboss.as.naming.ManagedReferenceFactory) EventListener(java.util.EventListener)

Aggregations

ListenerInfo (io.undertow.servlet.api.ListenerInfo)16 ServletInfo (io.undertow.servlet.api.ServletInfo)11 DeploymentInfo (io.undertow.servlet.api.DeploymentInfo)10 PathHandler (io.undertow.server.handlers.PathHandler)9 ServletContainer (io.undertow.servlet.api.ServletContainer)9 DeploymentManager (io.undertow.servlet.api.DeploymentManager)8 BeforeClass (org.junit.BeforeClass)8 ServletException (javax.servlet.ServletException)6 ManagedListener (io.undertow.servlet.core.ManagedListener)4 HandlerWrapper (io.undertow.server.HandlerWrapper)3 ServletContainerInitializerInfo (io.undertow.servlet.api.ServletContainerInitializerInfo)3 SimpleServletTestCase (io.undertow.servlet.test.SimpleServletTestCase)3 MessageServlet (io.undertow.servlet.test.util.MessageServlet)3 ImmediateInstanceFactory (io.undertow.servlet.util.ImmediateInstanceFactory)3 ServletContextListener (javax.servlet.ServletContextListener)3 HttpHandler (io.undertow.server.HttpHandler)2 ServletExtension (io.undertow.servlet.ServletExtension)2 ErrorPage (io.undertow.servlet.api.ErrorPage)2 FilterInfo (io.undertow.servlet.api.FilterInfo)2 LoginConfig (io.undertow.servlet.api.LoginConfig)2