Package io.undertow.predicate
Class Predicates
java.lang.Object
io.undertow.predicate.Predicates
Utility class used for creating predicates
- Author:
- Stuart Douglas
-
Method Summary
Modifier and TypeMethodDescriptionstatic PredicateCreates a predicate that returns true if an only if the given predicates all return true.static PredicateA predicate that returns true if authentication is requiredstatic Predicatecontains(ExchangeAttribute attribute, String... values) Returns true if the given attribute is present and contains one of the provided value.static Predicateequals(ExchangeAttribute[] attributes) Creates a procedure that returns true if the given ExchangeAttributes are equal.static Predicateexists(ExchangeAttribute attribute) Return a predicate that will return true if the given attribute is not null and not empty.static PredicatePredicate which always returns false.static PredicatemaxContentSize(long size) Predicate that returns true if the Content-Size of a request is above a given value.static PredicateminContentSize(long size) Predicate that returns true if the Content-Size of a request is below a given value.static PredicateCreates a predicate that returns true if the given predicate returns false.static PredicateCreates a predicate that returns true if any of the given predicates return true.static Predicateparses the predicate string, and returns the result, using the TCCL to load predicate definitionsstatic Predicateparse(String predicate, ClassLoader classLoader) parses the predicate string, and returns the resultstatic PredicateCreates a predicate that returns true if the given path matches exactly.static PredicateCreates a predicate that returns true if any of the given paths match exactly.static PredicateCreates a predicate that returns true if the given relative path starts with the provided prefix.static PredicateCreates a predicate that returns true if the relative request path matches any of the provided prefixes.static Predicateregex(ExchangeAttribute attribute, String pattern) Creates a predicate that matches the given attribute against a regex.static Predicateregex(ExchangeAttribute attribute, String pattern, boolean requireFullMatch) Creates a predicate that matches the given attribute against a regex.static Predicateregex(String attribute, String pattern, ClassLoader classLoader, boolean requireFullMatch) Creates a predicate that matches the given attribute against a regex.static Predicatesecure()static PredicateCreates a predicate that returns true if the request path ends with the provided suffix.static PredicateCreates a predicate that returns true if the request path ends with any of the provided suffixes.static PredicatePrediction which always returns true
-
Method Details
-
equals
Creates a procedure that returns true if the given ExchangeAttributes are equal.- Parameters:
attributes- to be compared in the predictor.- Returns:
- A new EqualsPredicate.
-
and
Creates a predicate that returns true if an only if the given predicates all return true. -
or
Creates a predicate that returns true if any of the given predicates return true. -
not
Creates a predicate that returns true if the given predicate returns false. -
path
Creates a predicate that returns true if the given path matches exactly. -
paths
Creates a predicate that returns true if any of the given paths match exactly. -
suffix
Creates a predicate that returns true if the request path ends with the provided suffix. -
suffixes
Creates a predicate that returns true if the request path ends with any of the provided suffixes. -
prefix
Creates a predicate that returns true if the given relative path starts with the provided prefix. -
prefixes
Creates a predicate that returns true if the relative request path matches any of the provided prefixes. -
maxContentSize
Predicate that returns true if the Content-Size of a request is above a given value. -
minContentSize
Predicate that returns true if the Content-Size of a request is below a given value. -
truePredicate
Prediction which always returns true -
falsePredicate
Predicate which always returns false. -
exists
Return a predicate that will return true if the given attribute is not null and not empty.- Parameters:
attribute- The attribute to check whether it exists or not.
-
contains
Returns true if the given attribute is present and contains one of the provided value.- Parameters:
attribute- The exchange attribute.values- The values to check for.
-
regex
Creates a predicate that matches the given attribute against a regex. A full match is not required- Parameters:
attribute- The exchange attribute to check against.pattern- The pattern to look for.
-
regex
public static Predicate regex(ExchangeAttribute attribute, String pattern, boolean requireFullMatch) Creates a predicate that matches the given attribute against a regex.- Parameters:
requireFullMatch- If a full match is required in order to return true.attribute- The attribute to check against.pattern- The pattern to look for.
-
regex
public static Predicate regex(String attribute, String pattern, ClassLoader classLoader, boolean requireFullMatch) Creates a predicate that matches the given attribute against a regex.- Parameters:
requireFullMatch- If a full match is required in order to return true.attribute- The attribute to check against.pattern- The pattern to look for.
-
authRequired
A predicate that returns true if authentication is required- Returns:
- A predicate that returns true if authentication is required
-
parse
parses the predicate string, and returns the result, using the TCCL to load predicate definitions- Parameters:
predicate- The prediate string- Returns:
- The predicate
-
parse
parses the predicate string, and returns the result- Parameters:
predicate- The prediate stringclassLoader- The class loader to load the predicates from- Returns:
- The predicate
-
secure
- Returns:
- A predicate that returns true if the request is secure
-