Class Filters


  • public final class Filters
    extends Object
    This class contains methods for creating various kinds of Filter and FilterConditions.
    • Method Detail

      • and

        public static FilterCondition and​(Collection<FilterCondition> conditions)
        Returns a FilterCondition which will only match requests which match all the provided conditions.
        Parameters:
        conditions - The conditions which requests must match.
        Returns:
        The filter condition.
      • and

        public static FilterCondition and​(FilterCondition... conditions)
        Returns a FilterCondition which will only match requests which match all the provided conditions.
        Parameters:
        conditions - The conditions which requests must match.
        Returns:
        The filter condition.
      • conditionalFilter

        public static Filter conditionalFilter​(FilterCondition condition,
                                               Filter subFilter)
        Returns a Filter which will only invoke subFilter when the provided filter condition matches the request being processed.
        Parameters:
        condition - The filter condition.
        subFilter - The sub-filter to be invoked when the condition matches.
        Returns:
        The wrapped filter.
      • matchRequestType

        public static FilterCondition matchRequestType​(RequestType... types)
        Returns a FilterCondition which will only match requests whose type is contained in types.
        Parameters:
        types - The request types which should be handled by the filter.
        Returns:
        The filter condition.
        See Also:
        Request.getRequestType()
      • matchRequestType

        public static FilterCondition matchRequestType​(Set<RequestType> types)
        Returns a FilterCondition which will only match requests whose type is contained in types.
        Parameters:
        types - The request types which should be handled by the filter.
        Returns:
        The filter condition.
        See Also:
        Request.getRequestType()
      • matchResourcePath

        public static FilterCondition matchResourcePath​(Pattern regex)
        Returns a FilterCondition which will only match requests whose resource path matches the provided regular expression.
        Parameters:
        regex - The regular expression which must match a request's resource path.
        Returns:
        The filter condition.
        See Also:
        Request.getResourcePath()
      • matchResourcePath

        public static FilterCondition matchResourcePath​(String regex)
        Returns a FilterCondition which will only match requests whose resource path matches the provided regular expression.
        Parameters:
        regex - The regular expression which must match a request's resource path.
        Returns:
        The filter condition.
        See Also:
        Request.getResourcePath()
      • not

        public static FilterCondition not​(FilterCondition condition)
        Returns a FilterCondition which will match requests which do not match the provided condition.
        Parameters:
        condition - The condition which requests must not match.
        Returns:
        The filter condition.
      • or

        public static FilterCondition or​(Collection<FilterCondition> conditions)
        Returns a FilterCondition which will match requests which match any of the provided conditions.
        Parameters:
        conditions - The conditions which requests may match.
        Returns:
        The filter condition.
      • or

        public static FilterCondition or​(FilterCondition... conditions)
        Returns a FilterCondition which will match requests which match any of the provided conditions.
        Parameters:
        conditions - The conditions which requests may match.
        Returns:
        The filter condition.