Class DelegatingFilterProxyRegistrationBean
java.lang.Object
org.springframework.boot.web.servlet.RegistrationBean
org.springframework.boot.web.servlet.DynamicRegistrationBean<FilterRegistration.Dynamic>
org.springframework.boot.web.servlet.AbstractFilterRegistrationBean<DelegatingFilterProxy>
org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean
- All Implemented Interfaces:
Aware
,BeanNameAware
,ServletContextInitializer
,ApplicationContextAware
,Ordered
public class DelegatingFilterProxyRegistrationBean
extends AbstractFilterRegistrationBean<DelegatingFilterProxy>
implements ApplicationContextAware
A
ServletContextInitializer
to register DelegatingFilterProxy
s in a
Servlet 3.0+ container. Similar to the registration
features provided by ServletContext
but with a Spring Bean
friendly design.
The bean name of the actual delegate Filter
should be specified using the
targetBeanName
constructor argument. Unlike the FilterRegistrationBean
,
referenced filters are not instantiated early. In fact, if the delegate filter bean is
marked @Lazy
it won't be instantiated at all until the filter is called.
Registrations can be associated with URL patterns
and/or
servlets (either by name
or through a
ServletRegistrationBean
s). When no URL pattern or
servlets are specified the filter will be associated to '/*'. The targetBeanName will
be used as the filter name if not otherwise specified.
- Since:
- 1.4.0
- Author:
- Phillip Webb
- See Also:
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorDescriptionDelegatingFilterProxyRegistrationBean
(String targetBeanName, ServletRegistrationBean<?>... servletRegistrationBeans) Create a newDelegatingFilterProxyRegistrationBean
instance to be registered with the specifiedServletRegistrationBean
s. -
Method Summary
Modifier and TypeMethodDescriptionReturn theFilter
to be registered.protected String
void
setApplicationContext
(ApplicationContext applicationContext) Methods inherited from class org.springframework.boot.web.servlet.AbstractFilterRegistrationBean
addRegistration, addServletNames, addServletRegistrationBeans, addUrlPatterns, configure, getDescription, getServletNames, getServletRegistrationBeans, getUrlPatterns, isMatchAfter, setDispatcherTypes, setDispatcherTypes, setMatchAfter, setServletNames, setServletRegistrationBeans, setUrlPatterns, toString
Methods inherited from class org.springframework.boot.web.servlet.DynamicRegistrationBean
addInitParameter, getInitParameters, getOrDeduceName, isAsyncSupported, register, setAsyncSupported, setBeanName, setIgnoreRegistrationFailure, setInitParameters, setName
Methods inherited from class org.springframework.boot.web.servlet.RegistrationBean
getOrder, isEnabled, onStartup, setEnabled, setOrder
-
Constructor Details
-
DelegatingFilterProxyRegistrationBean
public DelegatingFilterProxyRegistrationBean(String targetBeanName, ServletRegistrationBean<?>... servletRegistrationBeans) Create a newDelegatingFilterProxyRegistrationBean
instance to be registered with the specifiedServletRegistrationBean
s.- Parameters:
targetBeanName
- name of the target filter bean to look up in the Spring application context (must not benull
).servletRegistrationBeans
- associateServletRegistrationBean
s
-
-
Method Details
-
setApplicationContext
- Specified by:
setApplicationContext
in interfaceApplicationContextAware
- Throws:
BeansException
-
getTargetBeanName
-
getFilter
Description copied from class:AbstractFilterRegistrationBean
Return theFilter
to be registered.- Specified by:
getFilter
in classAbstractFilterRegistrationBean<DelegatingFilterProxy>
- Returns:
- the filter
-