|
Apache Tomcat 7.0.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.catalina.util.LifecycleBase
org.apache.catalina.util.LifecycleMBeanBase
org.apache.catalina.valves.ValveBase
org.apache.catalina.valves.RequestFilterValve
public abstract class RequestFilterValve
Implementation of a Valve that performs filtering based on comparing the appropriate request property (selected based on which subclass you choose to configure into your Container's pipeline) against a set of regular expressions configured for this Valve.
This valve 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 Valve may be attached to any Container, depending on the granularity of the filtering you wish to perform.
Field Summary | |
---|---|
protected String |
allow
The comma-delimited set of allow expressions. |
protected Pattern[] |
allows
The set of allow regular expressions we will evaluate. |
protected Pattern[] |
denies
The set of deny regular expressions we will evaluate. |
protected String |
deny
The comma-delimited set of deny expressions. |
protected static StringManager |
sm
The StringManager for this package. |
Fields inherited from class org.apache.catalina.valves.ValveBase |
---|
asyncSupported, container, containerLog, next |
Fields inherited from class org.apache.catalina.util.LifecycleMBeanBase |
---|
mserver |
Fields inherited from interface org.apache.catalina.Lifecycle |
---|
AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, DESTROY_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT |
Constructor Summary | |
---|---|
RequestFilterValve()
|
Method Summary | |
---|---|
String |
getAllow()
Return a comma-delimited set of the allow expressions
configured for this Valve, if any; otherwise, return null . |
String |
getDeny()
Return a comma-delimited set of the deny expressions
configured for this Valve, if any; otherwise, return null . |
String |
getInfo()
Return descriptive information about this Valve implementation. |
abstract void |
invoke(Request request,
Response response)
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. |
protected Pattern[] |
precalculate(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(String property,
Request request,
Response response)
Perform the filtering that has been configured for this Valve, matching against the specified request property. |
void |
setAllow(String allow)
Set the comma-delimited set of the allow expressions
configured for this Valve, if any. |
void |
setDeny(String deny)
Set the comma-delimited set of the deny expressions
configured for this Valve, if any. |
Methods inherited from class org.apache.catalina.valves.ValveBase |
---|
backgroundProcess, event, getContainer, getDomainInternal, getNext, getObjectNameKeyProperties, initInternal, isAsyncSupported, setAsyncSupported, setContainer, setNext, startInternal, stopInternal, toString |
Methods inherited from class org.apache.catalina.util.LifecycleMBeanBase |
---|
destroyInternal, getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister |
Methods inherited from class org.apache.catalina.util.LifecycleBase |
---|
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, init, removeLifecycleListener, setState, setState, start, stop |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final StringManager sm
protected String allow
allow
expressions.
protected Pattern[] allows
allow
regular expressions we will evaluate.
protected Pattern[] denies
deny
regular expressions we will evaluate.
protected String deny
deny
expressions.
Constructor Detail |
---|
public RequestFilterValve()
Method Detail |
---|
public String getAllow()
allow
expressions
configured for this Valve, if any; otherwise, return null
.
public void setAllow(String allow)
allow
expressions
configured for this Valve, if any.
allow
- The new set of allow expressionspublic String getDeny()
deny
expressions
configured for this Valve, if any; otherwise, return null
.
public void setDeny(String deny)
deny
expressions
configured for this Valve, if any.
deny
- The new set of deny expressionspublic String getInfo()
getInfo
in interface Valve
getInfo
in class ValveBase
public abstract void invoke(Request request, Response response) throws IOException, ServletException
process()
method to perform the actual filtering.
This method must be implemented by a concrete subclass.
invoke
in interface Valve
invoke
in class ValveBase
request
- The servlet request to be processedresponse
- The servlet response to be created
IOException
- if an input/output error occurs
ServletException
- if a servlet error occursprotected Pattern[] precalculate(String list)
null
or a comma-delimited
list of regular expression patterns.
list
- The comma-separated list of patterns
IllegalArgumentException
- if one of the patterns has
invalid syntaxprotected void process(String property, Request request, Response response) throws IOException, ServletException
property
- The request property on which to filterrequest
- The servlet request to be processedresponse
- The servlet response to be processed
IOException
- if an input/output error occurs
ServletException
- if a servlet error occurs
|
Apache Tomcat 7.0.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |