T - the type of listenerpublic class ServletListenerRegistrationBean<T extends java.util.EventListener> extends RegistrationBean
ServletContextInitializer to register EventListeners in a Servlet
3.0+ container. Similar to the registration features provided by ServletContext but with a Spring Bean
friendly design.
This bean can be used to register the following types of listener:
ServletContextAttributeListenerServletRequestListenerServletRequestAttributeListenerHttpSessionAttributeListenerHttpSessionIdListenerHttpSessionListenerServletContextListener| Constructor and Description |
|---|
ServletListenerRegistrationBean()
Create a new
ServletListenerRegistrationBean instance. |
ServletListenerRegistrationBean(T listener)
Create a new
ServletListenerRegistrationBean instance. |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
getDescription()
Return a description of the registration.
|
T |
getListener()
Return the listener to be registered.
|
static java.util.Set<java.lang.Class<?>> |
getSupportedTypes()
Return the supported types for this registration.
|
static boolean |
isSupportedType(java.util.EventListener listener)
Returns
true if the specified listener is one of the supported types. |
protected void |
register(java.lang.String description,
javax.servlet.ServletContext servletContext)
Register this bean with the servlet context.
|
void |
setListener(T listener)
Set the listener that will be registered.
|
getOrder, isEnabled, onStartup, setEnabled, setOrderpublic ServletListenerRegistrationBean()
ServletListenerRegistrationBean instance.public ServletListenerRegistrationBean(T listener)
ServletListenerRegistrationBean instance.listener - the listener to registerpublic void setListener(T listener)
listener - the listener to registerpublic T getListener()
protected java.lang.String getDescription()
RegistrationBeangetDescription in class RegistrationBeanprotected void register(java.lang.String description,
javax.servlet.ServletContext servletContext)
RegistrationBeanregister in class RegistrationBeandescription - a description of the item being registeredservletContext - the servlet contextpublic static boolean isSupportedType(java.util.EventListener listener)
true if the specified listener is one of the supported types.listener - the listener to testpublic static java.util.Set<java.lang.Class<?>> getSupportedTypes()