Top Description Constructors Methods
io.undertow.predicate

public Class Predicates

extends Object
Class Inheritance
Imports
io.undertow.attribute.ExchangeAttribute, .ExchangeAttributes

Utility class used for creating predicates
Author
Stuart Douglas

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Predicate
and(final Predicate... predicates)

Creates a predicate that returns true if an only if the given predicates all return true.

public static Predicate

Returns:

A predicate that returns true if authentication is required
authRequired
()

A predicate that returns true if authentication is required

public static Predicate
contains(final ExchangeAttribute
The exchange attribute.
attribute
,
final String...
The values to check for.
values
)

Returns true if the given attribute is present and contains one of the provided value.

public static Predicate

Returns:

A new EqualsPredicate.
equals
(final ExchangeAttribute[]
to be compared in the predictor.
attributes
)

Creates a procedure that returns true if the given ExchangeAttributes are equal.

public static Predicate
exists(final ExchangeAttribute
The attribute to check whether it exists or not.
attribute
)

Return a predicate that will return true if the given attribute is not null and not empty.

public static Predicate
falsePredicate()

Predicate which always returns false.

public static Predicate
maxContentSize(final long size)
Deprecated

Predicate that returns true if the Content-Size of a request is above a given value.

public static Predicate
minContentSize(final long size)
Deprecated

Predicate that returns true if the Content-Size of a request is below a given value.

public static Predicate
not(final Predicate predicate)

Creates a predicate that returns true if the given predicate returns false.

public static Predicate
or(final Predicate... predicates)

Creates a predicate that returns true if any of the given predicates return true.

public static Predicate

Returns:

The predicate
parse
(final String
The prediate string
predicate
)

parses the predicate string, and returns the result, using the TCCL to load predicate definitions

public static Predicate

Returns:

The predicate
parse
(final String
The prediate string
predicate
,
ClassLoader
The class loader to load the predicates from
classLoader
)

parses the predicate string, and returns the result

public static Predicate
path(final String path)

Creates a predicate that returns true if the given path matches exactly.

public static Predicate
paths(final String... paths)

Creates a predicate that returns true if any of the given paths match exactly.

public static Predicate
prefix(final String path)

Creates a predicate that returns true if the given relative path starts with the provided prefix.

public static Predicate
prefixes(final String... paths)

Creates a predicate that returns true if the relative request path matches any of the provided prefixes.

public static Predicate
regex(final ExchangeAttribute
The exchange attribute to check against.
attribute
,
final String
The pattern to look for.
pattern
)

Creates a predicate that matches the given attribute against a regex.

public static Predicate
regex(final ExchangeAttribute
The attribute to check against.
attribute
,
final String
The pattern to look for.
pattern
,
boolean
If a full match is required in order to return true.
requireFullMatch
)

Creates a predicate that matches the given attribute against a regex.

public static Predicate
regex(final String
The attribute to check against.
attribute
,
final String
The pattern to look for.
pattern
,
final ClassLoader classLoader, final boolean
If a full match is required in order to return true.
requireFullMatch
)

Creates a predicate that matches the given attribute against a regex.

public static Predicate
requestLargerThan(final long size)

Predicate that returns true if the Content-Size of a request is larger than a given size.

public static Predicate
requestSmallerThan(final long size)

Predicate that returns true if the Content-Size of a request is smaller than a given size.

public static Predicate

Returns:

A predicate that returns true if the request is secure
secure
()

public static Predicate
suffix(final String path)

Creates a predicate that returns true if the request path ends with the provided suffix.

public static Predicate
suffixes(final String... paths)

Creates a predicate that returns true if the request path ends with any of the provided suffixes.

public static Predicate
truePredicate()

Prediction which always returns true

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Predicatesback to summary
private Predicates()

Method Detail

andback to summary
public static Predicate and(final Predicate... predicates)

Creates a predicate that returns true if an only if the given predicates all return true.

authRequiredback to summary
public static Predicate authRequired()

A predicate that returns true if authentication is required

Returns:Predicate

A predicate that returns true if authentication is required

containsback to summary
public static Predicate contains(final ExchangeAttribute attribute, final String... values)

Returns true if the given attribute is present and contains one of the provided value.

Parameters
attribute:ExchangeAttribute

The exchange attribute.

values:String[]

The values to check for.

equalsback to summary
public static Predicate equals(final ExchangeAttribute[] attributes)

Creates a procedure that returns true if the given ExchangeAttributes are equal.

Parameters
attributes:ExchangeAttribute[]

to be compared in the predictor.

Returns:Predicate

A new EqualsPredicate.

existsback to summary
public static Predicate exists(final ExchangeAttribute attribute)

Return a predicate that will return true if the given attribute is not null and not empty.

Parameters
attribute:ExchangeAttribute

The attribute to check whether it exists or not.

falsePredicateback to summary
public static Predicate falsePredicate()

Predicate which always returns false.

maxContentSizeback to summary
public static Predicate maxContentSize(final long size)

Deprecated

Predicate that returns true if the Content-Size of a request is above a given value. Use requestLargerThan(long) instead.

Annotations
@Deprecated
minContentSizeback to summary
public static Predicate minContentSize(final long size)

Deprecated

Predicate that returns true if the Content-Size of a request is below a given value. Use requestSmallerThan(long) instead.

Annotations
@Deprecated
notback to summary
public static Predicate not(final Predicate predicate)

Creates a predicate that returns true if the given predicate returns false.

orback to summary
public static Predicate or(final Predicate... predicates)

Creates a predicate that returns true if any of the given predicates return true.

parseback to summary
public static Predicate parse(final String predicate)

parses the predicate string, and returns the result, using the TCCL to load predicate definitions

Parameters
predicate:String

The prediate string

Returns:Predicate

The predicate

parseback to summary
public static Predicate parse(final String predicate, ClassLoader classLoader)

parses the predicate string, and returns the result

Parameters
predicate:String

The prediate string

classLoader:ClassLoader

The class loader to load the predicates from

Returns:Predicate

The predicate

pathback to summary
public static Predicate path(final String path)

Creates a predicate that returns true if the given path matches exactly.

pathsback to summary
public static Predicate paths(final String... paths)

Creates a predicate that returns true if any of the given paths match exactly.

prefixback to summary
public static Predicate prefix(final String path)

Creates a predicate that returns true if the given relative path starts with the provided prefix.

prefixesback to summary
public static Predicate prefixes(final String... paths)

Creates a predicate that returns true if the relative request path matches any of the provided prefixes.

regexback to summary
public static Predicate regex(final ExchangeAttribute attribute, final String pattern)

Creates a predicate that matches the given attribute against a regex. A full match is not required

Parameters
attribute:ExchangeAttribute

The exchange attribute to check against.

pattern:String

The pattern to look for.

regexback to summary
public static Predicate regex(final ExchangeAttribute attribute, final String pattern, boolean requireFullMatch)

Creates a predicate that matches the given attribute against a regex.

Parameters
attribute:ExchangeAttribute

The attribute to check against.

pattern:String

The pattern to look for.

requireFullMatch:boolean

If a full match is required in order to return true.

regexback to summary
public static Predicate regex(final String attribute, final String pattern, final ClassLoader classLoader, final boolean requireFullMatch)

Creates a predicate that matches the given attribute against a regex.

Parameters
attribute:String

The attribute to check against.

pattern:String

The pattern to look for.

requireFullMatch:boolean

If a full match is required in order to return true.

requestLargerThanback to summary
public static Predicate requestLargerThan(final long size)

Predicate that returns true if the Content-Size of a request is larger than a given size.

requestSmallerThanback to summary
public static Predicate requestSmallerThan(final long size)

Predicate that returns true if the Content-Size of a request is smaller than a given size.

secureback to summary
public static Predicate secure()
Returns:Predicate

A predicate that returns true if the request is secure

suffixback to summary
public static Predicate suffix(final String path)

Creates a predicate that returns true if the request path ends with the provided suffix.

suffixesback to summary
public static Predicate suffixes(final String... paths)

Creates a predicate that returns true if the request path ends with any of the provided suffixes.

truePredicateback to summary
public static Predicate truePredicate()

Prediction which always returns true