use of io.undertow.servlet.core.ManagedListener in project wildfly by wildfly.
the class UndertowContext method addSessionListener.
@Override
public void addSessionListener(HttpSessionListener listener) {
ManagedListener ml = new ManagedListener(new ListenerInfo(HttpSessionListener.class, new ImmediateInstanceFactory<>(listener)), true);
try {
ml.start();
} catch (ServletException e) {
throw new RuntimeException(e);
}
this.deployment.getApplicationListeners().addListener(ml);
}
use of io.undertow.servlet.core.ManagedListener in project undertow by undertow-io.
the class ServletContextImpl method addListener.
@Override
public <T extends EventListener> void addListener(final T t) {
ensureNotInitialized();
ensureNotProgramaticListener();
if (ApplicationListeners.listenerState() != NO_LISTENER && ServletContextListener.class.isAssignableFrom(t.getClass())) {
throw UndertowServletMessages.MESSAGES.cannotAddServletContextListener();
}
ListenerInfo listener = new ListenerInfo(t.getClass(), new ImmediateInstanceFactory<EventListener>(t));
getDeploymentInfo().addListener(listener);
deployment.getApplicationListeners().addListener(new ManagedListener(listener, true));
}
use of io.undertow.servlet.core.ManagedListener in project wildfly by wildfly.
the class UndertowContext method addRequestListener.
@Override
public void addRequestListener(org.jboss.modcluster.container.listeners.ServletRequestListener requestListener) {
ServletRequestListener listener = new ServletRequestListener() {
@Override
public void requestInitialized(ServletRequestEvent sre) {
requestListener.requestInitialized();
}
@Override
public void requestDestroyed(ServletRequestEvent sre) {
requestListener.requestDestroyed();
}
};
ManagedListener ml = new ManagedListener(new ListenerInfo(ServletRequestListener.class, new ImmediateInstanceFactory<>(listener)), true);
try {
ml.start();
} catch (ServletException e) {
throw new RuntimeException(e);
}
this.deployment.getApplicationListeners().addListener(ml);
}
use of io.undertow.servlet.core.ManagedListener in project wildfly by wildfly.
the class UndertowContext method addSessionListener.
@Override
public void addSessionListener(org.jboss.modcluster.container.listeners.HttpSessionListener sessionListener) {
HttpSessionListener listener = new HttpSessionListener() {
@Override
public void sessionCreated(HttpSessionEvent se) {
sessionListener.sessionCreated();
}
@Override
public void sessionDestroyed(HttpSessionEvent se) {
sessionListener.sessionDestroyed();
}
};
ManagedListener ml = new ManagedListener(new ListenerInfo(HttpSessionListener.class, new ImmediateInstanceFactory<>(listener)), true);
try {
ml.start();
} catch (ServletException e) {
throw new RuntimeException(e);
}
this.deployment.getApplicationListeners().addListener(ml);
}
use of io.undertow.servlet.core.ManagedListener in project wildfly by wildfly.
the class UndertowContext method addRequestListener.
@Override
public void addRequestListener(ServletRequestListener listener) {
ManagedListener ml = new ManagedListener(new ListenerInfo(ServletRequestListener.class, new ImmediateInstanceFactory<>(listener)), true);
try {
ml.start();
} catch (ServletException e) {
throw new RuntimeException(e);
}
this.deployment.getApplicationListeners().addListener(ml);
}
Aggregations