Filter
RemoteAddrFilter
, RemoteHostFilter
public abstract class RequestFilter extends FilterBase
This filter is configured by setting the allow
and/or
deny
properties to a regular expressions (in the syntax
supported by Pattern
) to which the appropriate request property will
be compared. Evaluation proceeds as follows:
process()
method.
Modifier and Type | Field | Description |
---|---|---|
protected java.util.regex.Pattern |
allow |
The regular expression used to test for allowed requests.
|
protected java.util.regex.Pattern |
deny |
The regular expression used to test for denied requests.
|
protected int |
denyStatus |
The HTTP response status code that is used when rejecting denied
request.
|
sm
Constructor | Description |
---|---|
RequestFilter() |
Modifier and Type | Method | 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() |
|
java.lang.String |
getDeny() |
|
int |
getDenyStatus() |
|
protected boolean |
isConfigProblemFatal() |
Determines if an exception when calling a setter or an unknown
configuration attribute triggers the failure of the this filter which in
turn will prevent the web application from starting.
|
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.
|
void |
setAllow(java.lang.String allow) |
Set the regular expression used to test for allowed requests for this
Filter, if any.
|
void |
setDeny(java.lang.String deny) |
Set the regular expression used to test for denied requests for this
Filter, if any.
|
void |
setDenyStatus(int denyStatus) |
Set response status code that is used to reject denied request.
|
getLogger, init
protected java.util.regex.Pattern allow
protected java.util.regex.Pattern deny
protected int denyStatus
public java.lang.String getAllow()
null
.public void setAllow(java.lang.String allow)
allow
- The new allow expressionpublic java.lang.String getDeny()
null
.public void setDeny(java.lang.String deny)
deny
- The new deny expressionpublic int getDenyStatus()
public void setDenyStatus(int denyStatus)
denyStatus
- The status code for denypublic 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 boolean isConfigProblemFatal()
FilterBase
isConfigProblemFatal
in class FilterBase
true
if a problem should trigger the failure of this
filter, else false
protected 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 processedchain
- The filter chainjava.io.IOException
- if an input/output error occursServletException
- if a servlet error occursCopyright © 2000-2018 Apache Software Foundation. All Rights Reserved.