Class RequestFilter

java.lang.Object
org.apache.catalina.filters.FilterBase
org.apache.catalina.filters.RequestFilter
All Implemented Interfaces:
Filter
Direct Known Subclasses:
RemoteAddrFilter, RemoteHostFilter

public abstract class RequestFilter extends FilterBase
Implementation of a Filter 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 the regular expressions configured for this Filter.

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:

  • The subclass extracts the request property to be filtered, and calls the common process() method.
  • If there is a deny expression configured, the property will be compared to the expression. If a match is found, this request will be rejected with a "Forbidden" HTTP response.
  • If there is a allow expression configured, the property will be compared to the expression. If a match is found, this request will be allowed to pass through to the next filter in the current pipeline.
  • If a deny expression was specified but no allow expression, allow this request to pass through (because none of the deny expressions matched it).
  • The request will be rejected with a "Forbidden" HTTP response.