public abstract class RequestFilter extends FilterBase implements HttpEventFilter
This filter is configured by setting the allow
and/or
deny
properties to a comma-delimited list of regular
expressions (in the syntax supported by the jakarta-regexp library) to
which the appropriate request property will be compared. Evaluation
proceeds as follows:
process()
method.
This Filter may be attached to any Container, depending on the granularity of the filtering you wish to perform.
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
allow
The comma-delimited set of
allow expressions. |
protected java.util.regex.Pattern[] |
allows
The set of
allow regular expressions we will evaluate. |
protected java.util.regex.Pattern[] |
denies
The set of
deny regular expressions we will evaluate. |
protected java.lang.String |
deny
The comma-delimited set of
deny expressions. |
sm
Constructor and Description |
---|
RequestFilter() |
Modifier and Type | Method and Description |
---|---|
abstract void |
doFilter(ServletRequest request,
ServletResponse response,
FilterChain chain)
Extract the desired request property, and pass it (along with the
specified request and response objects) to the protected
process() method to perform the actual filtering. |
java.lang.String |
getAllow()
Return a comma-delimited set of the
allow expressions
configured for this Filter, if any; otherwise, return null . |
java.lang.String |
getDeny()
Return a comma-delimited set of the
deny expressions
configured for this Filter, if any; otherwise, return null . |
protected java.util.regex.Pattern[] |
precalculate(java.lang.String list)
Return an array of regular expression objects initialized from the
specified argument, which must be
null or a comma-delimited
list of regular expression patterns. |
protected void |
process(java.lang.String property,
ServletRequest request,
ServletResponse response,
FilterChain chain)
Perform the filtering that has been configured for this Filter, matching
against the specified request property.
|
protected void |
processCometEvent(java.lang.String property,
HttpEvent event,
HttpEventFilterChain chain)
Perform the filtering that has been configured for this Filter, matching
against the specified request property.
|
void |
setAllow(java.lang.String allow)
Set the comma-delimited set of the
allow expressions
configured for this Filter, if any. |
void |
setDeny(java.lang.String deny)
Set the comma-delimited set of the
deny expressions
configured for this Filter, if any. |
destroy, init
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
doFilterEvent
protected java.lang.String allow
allow
expressions.protected java.util.regex.Pattern[] allows
allow
regular expressions we will evaluate.protected java.util.regex.Pattern[] denies
deny
regular expressions we will evaluate.protected java.lang.String deny
deny
expressions.public java.lang.String getAllow()
allow
expressions
configured for this Filter, if any; otherwise, return null
.public void setAllow(java.lang.String allow)
allow
expressions
configured for this Filter, if any.allow
- The new set of allow expressionspublic java.lang.String getDeny()
deny
expressions
configured for this Filter, if any; otherwise, return null
.public void setDeny(java.lang.String deny)
deny
expressions
configured for this Filter, if any.deny
- The new set of deny expressionspublic abstract void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws java.io.IOException, ServletException
process()
method to perform the actual filtering.
This method must be implemented by a concrete subclass.request
- The servlet request to be processedresponse
- The servlet response to be createdchain
- The filter chainjava.io.IOException
- if an input/output error occursServletException
- if a servlet error occursprotected java.util.regex.Pattern[] precalculate(java.lang.String list)
null
or a comma-delimited
list of regular expression patterns.list
- The comma-separated list of patternsjava.lang.IllegalArgumentException
- if one of the patterns has
invalid syntaxprotected void process(java.lang.String property, ServletRequest request, ServletResponse response, FilterChain chain) throws java.io.IOException, ServletException
property
- The request property on which to filterrequest
- The servlet request to be processedresponse
- The servlet response to be processedjava.io.IOException
- if an input/output error occursServletException
- if a servlet error occursprotected void processCometEvent(java.lang.String property, HttpEvent event, HttpEventFilterChain chain) throws java.io.IOException, ServletException
property
- The property to check against the allow/deny rulesevent
- The comet event to be filteredchain
- The comet filter chainjava.io.IOException
- if an input/output error occursServletException
- if a servlet error occurs