Filter
HeaderFilter
public abstract class IncludeExcludeBasedFilter extends java.lang.Object implements Filter
This is an abstract filter which helps with filtering based on include/exclude of paths, mime types, and/or http methods.
Use the shouldFilter(HttpServletRequest, HttpServletResponse)
method to determine if a request/response should be filtered. If mime types are used,
it should be called after FilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
since the mime type may not
be written until then.
Supported init params:
includedPaths
- CSV of path specs to includeexcludedPaths
- CSV of path specs to excludeincludedMimeTypes
- CSV of mime types to includeexcludedMimeTypes
- CSV of mime types to excludeincludedHttpMethods
- CSV of http methods to includeexcludedHttpMethods
- CSV of http methods to excludePath spec rules:
'^'
the spec is assumed to be a regex based path spec and will match with normal Java regex rules.'/'
the spec is assumed to be a Servlet url-pattern rules path spec for either an exact match or prefix based
match.'*.'
the spec is assumed to be a Servlet url-pattern rules path spec for a suffix based match.
CSVs are parsed with StringUtil.csvSplit(String)
PathSpecSet
,
IncludeExcludeSet
Constructor | Description |
---|---|
IncludeExcludeBasedFilter() |
Modifier and Type | Method | Description |
---|---|---|
void |
destroy() |
|
protected java.lang.String |
guessMimeType(HttpServletRequest http_request,
HttpServletResponse http_response) |
|
void |
init(FilterConfig filterConfig) |
|
protected boolean |
shouldFilter(HttpServletRequest http_request,
HttpServletResponse http_response) |
|
java.lang.String |
toString() |
public void init(FilterConfig filterConfig) throws ServletException
init
in interface Filter
ServletException
protected java.lang.String guessMimeType(HttpServletRequest http_request, HttpServletResponse http_response)
protected boolean shouldFilter(HttpServletRequest http_request, HttpServletResponse http_response)
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 1995–2018 Webtide. All rights reserved.