@FunctionalInterface public interface RequestPredicate
ServerRequest.
Instances of this function that evaluate on common request properties
can be found in RequestPredicates.RequestPredicates,
RouterFunctions.route(RequestPredicate, HandlerFunction),
RouterFunctions.nest(RequestPredicate, RouterFunction)| Modifier and Type | Method and Description |
|---|---|
default void |
accept(RequestPredicates.Visitor visitor)
Accept the given visitor.
|
default RequestPredicate |
and(RequestPredicate other)
Return a composed request predicate that tests against both this predicate AND
the
other predicate. |
default RequestPredicate |
negate()
Return a predicate that represents the logical negation of this predicate.
|
default Optional<ServerRequest> |
nest(ServerRequest request)
Transform the given request into a request used for a nested route.
|
default RequestPredicate |
or(RequestPredicate other)
Return a composed request predicate that tests against both this predicate OR
the
other predicate. |
boolean |
test(ServerRequest request)
Evaluate this predicate on the given request.
|
boolean test(ServerRequest request)
request - the request to match againsttrue if the request matches the predicate; false otherwisedefault RequestPredicate and(RequestPredicate other)
other predicate. When evaluating the composed predicate, if this
predicate is false, then the other predicate is not evaluated.other - a predicate that will be logically-ANDed with this predicateother predicatedefault RequestPredicate negate()
default RequestPredicate or(RequestPredicate other)
other predicate. When evaluating the composed predicate, if this
predicate is true, then the other predicate is not evaluated.other - a predicate that will be logically-ORed with this predicateother predicatedefault Optional<ServerRequest> nest(ServerRequest request)
ServerRequest with a path remaining
after a match.
The default implementation returns an Optional wrapping the given request if
test(ServerRequest) evaluates to true; or Optional.empty()
if it evaluates to false.
request - the request to be nestedRouterFunctions.nest(RequestPredicate, RouterFunction)default void accept(RequestPredicates.Visitor visitor)
RequestPredicates.Visitor.unknown(RequestPredicate); composed RequestPredicate
implementations are expected to call accept for all components that make up this
request predicate.visitor - the visitor to accept