类 AbstractFilterRegistrationBean<T extends javax.servlet.Filter>
- java.lang.Object
- org.springframework.boot.web.servlet.RegistrationBean
- org.springframework.boot.web.servlet.DynamicRegistrationBean<javax.servlet.FilterRegistration.Dynamic>
- org.springframework.boot.web.servlet.AbstractFilterRegistrationBean<T>
- 类型参数:
T
- the type ofFilter
to register
- 所有已实现的接口:
ServletContextInitializer
,org.springframework.core.Ordered
public abstract class AbstractFilterRegistrationBean<T extends javax.servlet.Filter> extends DynamicRegistrationBean<javax.servlet.FilterRegistration.Dynamic>
Abstract baseServletContextInitializer
to registerFilter
s in a Servlet 3.0+ container.- 从以下版本开始:
- 2.0.1
字段概要
字段 修饰符和类型 字段 说明 protected static int
REQUEST_WRAPPER_FILTER_MAX_ORDER
已过时。since 2.1.0 in favor ofOrderedFilter.REQUEST_WRAPPER_FILTER_MAX_ORDER
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 protected javax.servlet.FilterRegistration.Dynamic
addRegistration(String description, javax.servlet.ServletContext servletContext)
void
addServletNames(String... servletNames)
Add servlet names for the filter.void
addServletRegistrationBeans(ServletRegistrationBean<?>... servletRegistrationBeans)
AddServletRegistrationBean
s for the filter.void
addUrlPatterns(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 String
getDescription()
Return a description of the registration.abstract T
getFilter()
Return theFilter
to be registered.Collection<String>
getServletNames()
Return a mutable collection of servlet names that the filter will be registered against.Collection<ServletRegistrationBean<?>>
getServletRegistrationBeans()
Return a mutable collection of theServletRegistrationBean
that the filter will be registered against.Collection<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(EnumSet<javax.servlet.DispatcherType> dispatcherTypes)
Sets the dispatcher types that should be used with the registration.void
setDispatcherTypes(javax.servlet.DispatcherType first, javax.servlet.DispatcherType... rest)
Convenience method toset dispatcher types
using the specified elements.void
setMatchAfter(boolean matchAfter)
Set if the filter mappings should be matched after any declared filter mappings of the ServletContext.void
setServletNames(Collection<String> servletNames)
Set servlet names that the filter will be registered against.void
setServletRegistrationBeans(Collection<? extends ServletRegistrationBean<?>> servletRegistrationBeans)
SetServletRegistrationBean
s that the filter will be registered against.void
setUrlPatterns(Collection<String> urlPatterns)
Set the URL patterns that the filter will be registered against.String
toString()
从类继承的方法 org.springframework.boot.web.servlet.DynamicRegistrationBean
addInitParameter, getInitParameters, getOrDeduceName, isAsyncSupported, register, setAsyncSupported, setInitParameters, setName
从类继承的方法 org.springframework.boot.web.servlet.RegistrationBean
getOrder, isEnabled, onStartup, setEnabled, setOrder
字段详细资料
REQUEST_WRAPPER_FILTER_MAX_ORDER
@Deprecated protected static final int REQUEST_WRAPPER_FILTER_MAX_ORDER
已过时。since 2.1.0 in favor ofOrderedFilter.REQUEST_WRAPPER_FILTER_MAX_ORDER
Filters that wrap the servlet request should be ordered less than or equal to this.- 另请参阅:
- 常量字段值
方法详细资料
setServletRegistrationBeans
public void setServletRegistrationBeans(Collection<? extends ServletRegistrationBean<?>> servletRegistrationBeans)
SetServletRegistrationBean
s that the filter will be registered against.- 参数:
servletRegistrationBeans
- the Servlet registration beans
getServletRegistrationBeans
public Collection<ServletRegistrationBean<?>> getServletRegistrationBeans()
Return a mutable collection of theServletRegistrationBean
that the filter will be registered against.ServletRegistrationBean
s.- 返回:
- the Servlet registration beans
- 另请参阅:
setServletNames(java.util.Collection<java.lang.String>)
,setUrlPatterns(java.util.Collection<java.lang.String>)
addServletRegistrationBeans
public void addServletRegistrationBeans(ServletRegistrationBean<?>... servletRegistrationBeans)
AddServletRegistrationBean
s for the filter.- 参数:
servletRegistrationBeans
- the servlet registration beans to add- 另请参阅:
setServletRegistrationBeans(java.util.Collection<? extends org.springframework.boot.web.servlet.ServletRegistrationBean<?>>)
setServletNames
public void setServletNames(Collection<String> servletNames)
Set servlet names that the filter will be registered against. This will replace any previously specified servlet names.
getServletNames
public Collection<String> getServletNames()
Return a mutable collection of servlet names that the filter will be registered against.- 返回:
- the servlet names
addServletNames
public void addServletNames(String... servletNames)
Add servlet names for the filter.- 参数:
servletNames
- the servlet names to add
setUrlPatterns
public void setUrlPatterns(Collection<String> urlPatterns)
Set the URL patterns that the filter will be registered against. This will replace any previously specified URL patterns.
getUrlPatterns
public Collection<String> getUrlPatterns()
Return a mutable collection of URL patterns, as defined in the Servlet specification, that the filter will be registered against.- 返回:
- the URL patterns
addUrlPatterns
public void addUrlPatterns(String... urlPatterns)
Add URL patterns, as defined in the Servlet specification, that the filter will be registered against.- 参数:
urlPatterns
- the URL patterns
setDispatcherTypes
public void setDispatcherTypes(javax.servlet.DispatcherType first, javax.servlet.DispatcherType... rest)
Convenience method toset dispatcher types
using the specified elements.- 参数:
first
- the first dispatcher typerest
- additional dispatcher types
setDispatcherTypes
public void setDispatcherTypes(EnumSet<javax.servlet.DispatcherType> dispatcherTypes)
Sets the dispatcher types that should be used with the registration. If not specified the types will be deduced based on the value ofDynamicRegistrationBean.isAsyncSupported()
.- 参数:
dispatcherTypes
- the dispatcher types
setMatchAfter
public void setMatchAfter(boolean matchAfter)
Set if the filter mappings should be matched after any declared filter mappings of the ServletContext. Defaults tofalse
indicating the filters are supposed to be matched before any declared filter mappings of the ServletContext.- 参数:
matchAfter
- if filter mappings are matched after
isMatchAfter
public boolean isMatchAfter()
Return if filter mappings should be matched after any declared Filter mappings of the ServletContext.- 返回:
- if filter mappings are matched after
getDescription
protected String getDescription()
从类复制的说明:RegistrationBean
Return a description of the registration. For example "Servlet resourceServlet"- 指定者:
getDescription
在类中RegistrationBean
- 返回:
- a description of the registration
addRegistration
protected javax.servlet.FilterRegistration.Dynamic addRegistration(String description, javax.servlet.ServletContext servletContext)
- 指定者:
addRegistration
在类中DynamicRegistrationBean<javax.servlet.FilterRegistration.Dynamic>
configure
protected void configure(javax.servlet.FilterRegistration.Dynamic registration)
Configure registration settings. Subclasses can override this method to perform additional configuration if required.- 覆盖:
configure
在类中DynamicRegistrationBean<javax.servlet.FilterRegistration.Dynamic>
- 参数:
registration
- the registration