T
- the type of listenerpublic class ServletListenerRegistrationBean<T extends EventListener> extends RegistrationBean
ServletContextInitializer
to register EventListener
s 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:
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
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(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, setOrder
public 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 RegistrationBean
name
- the name of the registration@Deprecated public void setAsyncSupported(boolean asyncSupported)
true
.setAsyncSupported
in class RegistrationBean
asyncSupported
- if async is supported@Deprecated public boolean isAsyncSupported()
isAsyncSupported
in class RegistrationBean
@Deprecated public void setInitParameters(Map<String,String> initParameters)
setInitParameters
in class RegistrationBean
initParameters
- 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 RegistrationBean
name
- the init-parameter namevalue
- the init-parameter valuepublic void onStartup(ServletContext servletContext) throws ServletException
ServletContextInitializer
ServletContext
with any servlets, filters, listeners
context-params and attributes necessary for initialization.servletContext
- the ServletContext
to initializeServletException
- if any call against the given ServletContext
throws a ServletException
public T getListener()
public static boolean isSupportedType(EventListener listener)
true
if the specified listener is one of the supported types.listener
- the listener to testCopyright © 2019 Pivotal Software, Inc.. All rights reserved.