Class DynamicRegistrationBean<D extends javax.servlet.Registration.Dynamic>
- java.lang.Object
- org.springframework.boot.web.servlet.RegistrationBean
- org.springframework.boot.web.servlet.DynamicRegistrationBean<D>
- Type Parameters:
D
- the dynamic registration result
- All Implemented Interfaces:
ServletContextInitializer
,org.springframework.core.Ordered
- Direct Known Subclasses:
AbstractFilterRegistrationBean
,ServletRegistrationBean
public abstract class DynamicRegistrationBean<D extends javax.servlet.Registration.Dynamic> extends RegistrationBean
Base class for Servlet 3.0+dynamic
based registration beans.- Since:
- 2.0.0
Constructor Summary
Constructors Constructor Description DynamicRegistrationBean()
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addInitParameter(String name, String value)
Add a single init-parameter, replacing any existing parameter with the same name.protected abstract D
addRegistration(String description, javax.servlet.ServletContext servletContext)
protected void
configure(D registration)
Map<String,String>
getInitParameters()
Returns a mutable Map of the registration init-parameters.protected String
getOrDeduceName(Object value)
Deduces the name for this registration.boolean
isAsyncSupported()
Returns if asynchronous operations are supported for this registration.protected void
register(String description, javax.servlet.ServletContext servletContext)
Register this bean with the servlet context.void
setAsyncSupported(boolean asyncSupported)
Sets if asynchronous operations are supported for this registration.void
setInitParameters(Map<String,String> initParameters)
Set init-parameters for this registration.void
setName(String name)
Set the name of this registration.Methods inherited from class org.springframework.boot.web.servlet.RegistrationBean
getDescription, getOrder, isEnabled, onStartup, setEnabled, setOrder
Constructor Detail
DynamicRegistrationBean
public DynamicRegistrationBean()
Method Detail
setName
public void setName(String name)
Set the name of this registration. If not specified the bean name will be used.- Parameters:
name
- the name of the registration
setAsyncSupported
public void setAsyncSupported(boolean asyncSupported)
Sets if asynchronous operations are supported for this registration. If not specified defaults totrue
.- Parameters:
asyncSupported
- if async is supported
isAsyncSupported
public boolean isAsyncSupported()
Returns if asynchronous operations are supported for this registration.- Returns:
- if async is supported
setInitParameters
public void setInitParameters(Map<String,String> initParameters)
Set init-parameters for this registration. Calling this method will replace any existing init-parameters.- Parameters:
initParameters
- the init parameters- See Also:
getInitParameters()
,addInitParameter(java.lang.String, java.lang.String)
getInitParameters
public Map<String,String> getInitParameters()
Returns a mutable Map of the registration init-parameters.- Returns:
- the init parameters
addInitParameter
public void addInitParameter(String name, String value)
Add a single init-parameter, replacing any existing parameter with the same name.- Parameters:
name
- the init-parameter namevalue
- the init-parameter value
register
protected final void register(String description, javax.servlet.ServletContext servletContext)
Description copied from class:RegistrationBean
Register this bean with the servlet context.- Specified by:
register
in classRegistrationBean
- Parameters:
description
- a description of the item being registeredservletContext
- the servlet context
addRegistration
protected abstract D addRegistration(String description, javax.servlet.ServletContext servletContext)
getOrDeduceName
protected final String getOrDeduceName(Object value)
Deduces the name for this registration. Will return user specified name or fallback to convention based naming.- Parameters:
value
- the object used for convention based names- Returns:
- the deduced name