Search in sources :

Example 71 with EventListener

use of java.util.EventListener in project tomcat by apache.

the class ApplicationContext method addListener.

@Override
public void addListener(String className) {
    try {
        if (context.getInstanceManager() != null) {
            Object obj = context.getInstanceManager().newInstance(className);
            if (!(obj instanceof EventListener)) {
                throw new IllegalArgumentException(sm.getString("applicationContext.addListener.iae.wrongType", className));
            }
            EventListener listener = (EventListener) obj;
            addListener(listener);
        }
    } catch (InvocationTargetException e) {
        ExceptionUtils.handleThrowable(e.getCause());
        throw new IllegalArgumentException(sm.getString("applicationContext.addListener.iae.cnfe", className), e);
    } catch (ReflectiveOperationException | NamingException e) {
        throw new IllegalArgumentException(sm.getString("applicationContext.addListener.iae.cnfe", className), e);
    }
}
Also used : NamingException(javax.naming.NamingException) EventListener(java.util.EventListener) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

EventListener (java.util.EventListener)71 Test (org.junit.Test)11 ListenerInfo (io.undertow.servlet.api.ListenerInfo)5 ServletRequestListener (javax.servlet.ServletRequestListener)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 ServletContextListener (javax.servlet.ServletContextListener)3 HttpSessionListener (javax.servlet.http.HttpSessionListener)3 ServletHolder (org.eclipse.jetty.servlet.ServletHolder)3 EventListenerList (org.eclipse.scout.rt.platform.util.EventListenerList)3 Bundle (org.osgi.framework.Bundle)3 BundleContext (org.osgi.framework.BundleContext)3 EntryListenerConfig (com.hazelcast.config.EntryListenerConfig)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 Method (java.lang.reflect.Method)2 EventObject (java.util.EventObject)2 List (java.util.List)2 NamingException (javax.naming.NamingException)2 ServletRequestEvent (javax.servlet.ServletRequestEvent)2 HttpSessionIdListener (javax.servlet.http.HttpSessionIdListener)2