public class FilterRegistrationBean extends AbstractFilterRegistrationBean
ServletContextInitializer
to register Filter
s in a Servlet 3.0+
container. Similar to the registration
features provided by ServletContext
but with a Spring Bean friendly design.
The Filter
must be specified before calling
AbstractFilterRegistrationBean.onStartup(ServletContext)
. Registrations can be associated with
URL patterns
and/or servlets (either by name
or via a ServletRegistrationBean
s. When no
URL pattern or servlets are specified the filter will be associated to '/*'. The filter
name will be deduced if not specified.
ServletContextInitializer
,
ServletContext.addFilter(String, Filter)
,
DelegatingFilterProxyRegistrationBean
Modifier and Type | Field and Description |
---|---|
static int |
REQUEST_WRAPPER_FILTER_MAX_ORDER
Filters that wrap the servlet request should be ordered less than or equal to this.
|
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
FilterRegistrationBean()
Create a new
FilterRegistrationBean instance. |
FilterRegistrationBean(Filter filter,
ServletRegistrationBean... servletRegistrationBeans)
Create a new
FilterRegistrationBean instance to be registered with the
specified ServletRegistrationBean s. |
Modifier and Type | Method and Description |
---|---|
Filter |
getFilter()
Return the
Filter to be registered. |
void |
setFilter(Filter filter)
Set the filter to be registered.
|
addServletNames, addServletRegistrationBeans, addUrlPatterns, configure, getServletNames, getServletRegistrationBeans, getUrlPatterns, isMatchAfter, onStartup, setDispatcherTypes, setDispatcherTypes, setMatchAfter, setServletNames, setServletRegistrationBeans, setUrlPatterns
addInitParameter, configure, getInitParameters, getOrDeduceName, getOrder, isAsyncSupported, isEnabled, setAsyncSupported, setEnabled, setInitParameters, setName, setOrder
public static final int REQUEST_WRAPPER_FILTER_MAX_ORDER
public FilterRegistrationBean()
FilterRegistrationBean
instance.public FilterRegistrationBean(Filter filter, ServletRegistrationBean... servletRegistrationBeans)
FilterRegistrationBean
instance to be registered with the
specified ServletRegistrationBean
s.filter
- the filter to registerservletRegistrationBeans
- associate ServletRegistrationBean
spublic Filter getFilter()
AbstractFilterRegistrationBean
Filter
to be registered.getFilter
in class AbstractFilterRegistrationBean
public void setFilter(Filter filter)
filter
- the filterCopyright © 2019 Pivotal Software, Inc.. All rights reserved.