Package net.shibboleth.shared.servlet
Class AbstractConditionalFilter
java.lang.Object
net.shibboleth.shared.servlet.AbstractConditionalFilter
- All Implemented Interfaces:
Filter
- Direct Known Subclasses:
CookieBufferingFilter,DynamicResponseHeaderFilter,RequestResponseContextFilter,SameSiteCookieHeaderFilter
Base class for HTTP servlet
Filter that determines whether to run dynamically
based on a supplied Predicate instead of based on mapping rules defined in web.xml.- Since:
- 9.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Predicate<ServletRequest>Whether filter should run or not. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()voiddoFilter(ServletRequest request, ServletResponse response, FilterChain chain) Get the condition to control activation of this filter.voidinit(FilterConfig filterConfig) protected abstract voidrunFilter(ServletRequest request, ServletResponse response, FilterChain chain) Subclasses should override this method to be called when the filter is directed to activate.voidsetActivationCondition(Predicate<ServletRequest> condition) Set the condition to control activation of this filter.
-
Field Details
-
activationCondition
Whether filter should run or not.
-
-
Constructor Details
-
AbstractConditionalFilter
public AbstractConditionalFilter()Constructor.
-
-
Method Details
-
getActivationCondition
Get the condition to control activation of this filter.- Returns:
- condition
-
setActivationCondition
Set the condition to control activation of this filter.- Parameters:
condition- run condition
-
init
- Specified by:
initin interfaceFilter- Throws:
ServletException
-
destroy
public void destroy() -
doFilter
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException - Specified by:
doFilterin interfaceFilter- Throws:
IOExceptionServletException
-
runFilter
protected abstract void runFilter(@Nonnull ServletRequest request, @Nonnull ServletResponse response, @Nonnull FilterChain chain) throws IOException, ServletException Subclasses should override this method to be called when the filter is directed to activate.- Parameters:
request- servlet requestresponse- servlet responsechain- filter chain- Throws:
ServletException- on errorIOException- on error
-