T - the type of listenerpublic class ServletListenerRegistrationBean<T extends 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:
ServletContextAttributeListenerServletRequestListenerServletRequestAttributeListenerHttpSessionAttributeListenerHttpSessionListenerServletContextListener| Constructor and Description |
|---|
ServletListenerRegistrationBean()
Create a new
ServletListenerRegistrationBean instance. |
ServletListenerRegistrationBean(T listener)
Create a new
ServletListenerRegistrationBean instance. |
| Modifier and Type | Method and Description |
|---|---|
void |
addInitParameter(String name,
String value)
Deprecated.
as of 1.5 since not applicable to listeners
|
Map<String,String> |
getInitParameters()
Deprecated.
as of 1.5 since not applicable to listeners
|
T |
getListener() |
static Set<Class<?>> |
getSupportedTypes()
Return the supported types for this registration.
|
boolean |
isAsyncSupported()
Deprecated.
as of 1.5 since not applicable to listeners
|
static boolean |
isSupportedType(EventListener listener)
Returns
true if the specified listener is one of the supported types. |
void |
onStartup(javax.servlet.ServletContext servletContext)
Configure the given
ServletContext with any servlets, filters, listeners
context-params and attributes necessary for initialization. |
void |
setAsyncSupported(boolean asyncSupported)
Deprecated.
as of 1.5 since not applicable to listeners
|
void |
setInitParameters(Map<String,String> initParameters)
Deprecated.
as of 1.5 since not applicable to listeners
|
void |
setListener(T listener)
Set the listener that will be registered.
|
void |
setName(String name)
Deprecated.
as of 1.5 since not applicable to listeners
|
configure, getOrDeduceName, getOrder, isEnabled, setEnabled, setOrderpublic ServletListenerRegistrationBean()
ServletListenerRegistrationBean instance.public ServletListenerRegistrationBean(T listener)
ServletListenerRegistrationBean instance.listener - the listener to registerpublic void setListener(T listener)
listener - the listener to register@Deprecated public void setName(String name)
setName in class RegistrationBeanname - the name of the registration@Deprecated public void setAsyncSupported(boolean asyncSupported)
true.setAsyncSupported in class RegistrationBeanasyncSupported - if async is supported@Deprecated public boolean isAsyncSupported()
isAsyncSupported in class RegistrationBean@Deprecated public void setInitParameters(Map<String,String> initParameters)
setInitParameters in class RegistrationBeaninitParameters - the init parametersRegistrationBean.getInitParameters(),
RegistrationBean.addInitParameter(java.lang.String, java.lang.String)@Deprecated public Map<String,String> getInitParameters()
getInitParameters in class RegistrationBean@Deprecated public void addInitParameter(String name, String value)
addInitParameter in class RegistrationBeanname - the init-parameter namevalue - the init-parameter valuepublic void onStartup(javax.servlet.ServletContext servletContext)
throws javax.servlet.ServletException
ServletContextInitializerServletContext with any servlets, filters, listeners
context-params and attributes necessary for initialization.servletContext - the ServletContext to initializejavax.servlet.ServletException - if any call against the given ServletContext
throws a ServletExceptionpublic T getListener()
public static boolean isSupportedType(EventListener listener)
true if the specified listener is one of the supported types.listener - the listener to testCopyright © 2018 Pivotal Software, Inc.. All rights reserved.