Package org.eclipse.jetty.servlets
Class IncludeExcludeBasedFilter
- java.lang.Object
-
- org.eclipse.jetty.servlets.IncludeExcludeBasedFilter
-
- All Implemented Interfaces:
Filter
- Direct Known Subclasses:
HeaderFilter
public abstract class IncludeExcludeBasedFilter extends Object implements Filter
Include Exclude Based FilterThis 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 afterFilterChain.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 exclude
Path spec rules:
- If the spec starts with
'^'the spec is assumed to be a regex based path spec and will match with normal Java regex rules. - If the spec starts with
'/'the spec is assumed to be a Servlet url-pattern rules path spec for either an exact match or prefix based match. - If the spec starts with
'*.'the spec is assumed to be a Servlet url-pattern rules path spec for a suffix based match. - All other syntaxes are unsupported.
CSVs are parsed with
StringUtil.csvSplit(String)- See Also:
PathSpecSet,IncludeExcludeSet
-
-
Constructor Summary
Constructors Constructor Description IncludeExcludeBasedFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()protected StringguessMimeType(HttpServletRequest http_request, HttpServletResponse http_response)voidinit(FilterConfig filterConfig)protected booleanshouldFilter(HttpServletRequest http_request, HttpServletResponse http_response)StringtoString()
-
-
-
Method Detail
-
init
public void init(FilterConfig filterConfig) throws ServletException
- Specified by:
initin interfaceFilter- Throws:
ServletException
-
guessMimeType
protected String guessMimeType(HttpServletRequest http_request, HttpServletResponse http_response)
-
shouldFilter
protected boolean shouldFilter(HttpServletRequest http_request, HttpServletResponse http_response)
-
-