T
- the type of Filter
to registerpublic abstract class AbstractFilterRegistrationBean<T extends javax.servlet.Filter> extends DynamicRegistrationBean<javax.servlet.FilterRegistration.Dynamic>
ServletContextInitializer
to register Filter
s in a
Servlet 3.0+ container.Modifier and Type | Method and Description |
---|---|
protected javax.servlet.FilterRegistration.Dynamic |
addRegistration(java.lang.String description,
javax.servlet.ServletContext servletContext) |
void |
addServletNames(java.lang.String... servletNames)
Add servlet names for the filter.
|
void |
addServletRegistrationBeans(ServletRegistrationBean<?>... servletRegistrationBeans)
Add
ServletRegistrationBean s for the filter. |
void |
addUrlPatterns(java.lang.String... urlPatterns)
Add URL patterns, as defined in the Servlet specification, that the filter will be
registered against.
|
protected void |
configure(javax.servlet.FilterRegistration.Dynamic registration)
Configure registration settings.
|
protected java.lang.String |
getDescription()
Return a description of the registration.
|
abstract T |
getFilter()
Return the
Filter to be registered. |
java.util.Collection<java.lang.String> |
getServletNames()
Return a mutable collection of servlet names that the filter will be registered
against.
|
java.util.Collection<ServletRegistrationBean<?>> |
getServletRegistrationBeans()
Return a mutable collection of the
ServletRegistrationBean that the filter
will be registered against. |
java.util.Collection<java.lang.String> |
getUrlPatterns()
Return a mutable collection of URL patterns, as defined in the Servlet
specification, that the filter will be registered against.
|
boolean |
isMatchAfter()
Return if filter mappings should be matched after any declared Filter mappings of
the ServletContext.
|
void |
setDispatcherTypes(javax.servlet.DispatcherType first,
javax.servlet.DispatcherType... rest)
Convenience method to
set dispatcher types
using the specified elements. |
void |
setDispatcherTypes(java.util.EnumSet<javax.servlet.DispatcherType> dispatcherTypes)
Sets the dispatcher types that should be used with the registration.
|
void |
setMatchAfter(boolean matchAfter)
Set if the filter mappings should be matched after any declared filter mappings of
the ServletContext.
|
void |
setServletNames(java.util.Collection<java.lang.String> servletNames)
Set servlet names that the filter will be registered against.
|
void |
setServletRegistrationBeans(java.util.Collection<? extends ServletRegistrationBean<?>> servletRegistrationBeans)
Set
ServletRegistrationBean s that the filter will be registered against. |
void |
setUrlPatterns(java.util.Collection<java.lang.String> urlPatterns)
Set the URL patterns that the filter will be registered against.
|
java.lang.String |
toString() |
addInitParameter, getInitParameters, getOrDeduceName, isAsyncSupported, register, setAsyncSupported, setInitParameters, setName
getOrder, isEnabled, onStartup, setEnabled, setOrder
public void setServletRegistrationBeans(java.util.Collection<? extends ServletRegistrationBean<?>> servletRegistrationBeans)
ServletRegistrationBean
s that the filter will be registered against.servletRegistrationBeans
- the Servlet registration beanspublic java.util.Collection<ServletRegistrationBean<?>> getServletRegistrationBeans()
ServletRegistrationBean
that the filter
will be registered against. ServletRegistrationBean
s.setServletNames(java.util.Collection<java.lang.String>)
,
setUrlPatterns(java.util.Collection<java.lang.String>)
public void addServletRegistrationBeans(ServletRegistrationBean<?>... servletRegistrationBeans)
ServletRegistrationBean
s for the filter.servletRegistrationBeans
- the servlet registration beans to addsetServletRegistrationBeans(java.util.Collection<? extends org.springframework.boot.web.servlet.ServletRegistrationBean<?>>)
public void setServletNames(java.util.Collection<java.lang.String> servletNames)
servletNames
- the servlet namessetServletRegistrationBeans(java.util.Collection<? extends org.springframework.boot.web.servlet.ServletRegistrationBean<?>>)
,
setUrlPatterns(java.util.Collection<java.lang.String>)
public java.util.Collection<java.lang.String> getServletNames()
public void addServletNames(java.lang.String... servletNames)
servletNames
- the servlet names to addpublic void setUrlPatterns(java.util.Collection<java.lang.String> urlPatterns)
urlPatterns
- the URL patternssetServletRegistrationBeans(java.util.Collection<? extends org.springframework.boot.web.servlet.ServletRegistrationBean<?>>)
,
setServletNames(java.util.Collection<java.lang.String>)
public java.util.Collection<java.lang.String> getUrlPatterns()
public void addUrlPatterns(java.lang.String... urlPatterns)
urlPatterns
- the URL patternspublic void setDispatcherTypes(javax.servlet.DispatcherType first, javax.servlet.DispatcherType... rest)
set dispatcher types
using the specified elements.first
- the first dispatcher typerest
- additional dispatcher typespublic void setDispatcherTypes(java.util.EnumSet<javax.servlet.DispatcherType> dispatcherTypes)
DynamicRegistrationBean.isAsyncSupported()
.dispatcherTypes
- the dispatcher typespublic void setMatchAfter(boolean matchAfter)
false
indicating the filters are supposed
to be matched before any declared filter mappings of the ServletContext.matchAfter
- if filter mappings are matched afterpublic boolean isMatchAfter()
protected java.lang.String getDescription()
RegistrationBean
getDescription
in class RegistrationBean
protected javax.servlet.FilterRegistration.Dynamic addRegistration(java.lang.String description, javax.servlet.ServletContext servletContext)
addRegistration
in class DynamicRegistrationBean<javax.servlet.FilterRegistration.Dynamic>
protected void configure(javax.servlet.FilterRegistration.Dynamic registration)
configure
in class DynamicRegistrationBean<javax.servlet.FilterRegistration.Dynamic>
registration
- the registrationpublic abstract T getFilter()
Filter
to be registered.public java.lang.String toString()
toString
in class java.lang.Object