接口 RequestPredicate
- 所有已知实现类:
RequestPredicates.AcceptPredicate,RequestPredicates.AndRequestPredicate,RequestPredicates.ContentTypePredicate,RequestPredicates.HeadersPredicate,RequestPredicates.HttpMethodPredicate,RequestPredicates.NegateRequestPredicate,RequestPredicates.OrRequestPredicate,RequestPredicates.ParamPredicate,RequestPredicates.PathExtensionPredicate,RequestPredicates.PathPatternPredicate,RequestPredicates.RequestModifyingPredicate
- 函数接口:
- 这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。
Represents a function that evaluates on a given
ServerRequest.
Instances of this function that evaluate on common request properties
can be found in RequestPredicates.- 从以下版本开始:
- 4.0
- 作者:
- Arjen Poutsma, Harry Yang
- 另请参阅:
-
方法概要
修饰符和类型方法说明default voidaccept(RequestPredicates.Visitor visitor) Accept the given visitor.default RequestPredicateand(RequestPredicate other) Return a composed request predicate that tests against both this predicate AND theotherpredicate.default RequestPredicatenegate()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 RequestPredicateor(RequestPredicate other) Return a composed request predicate that tests against both this predicate OR theotherpredicate.booleantest(ServerRequest request) Evaluate this predicate on the given request.
-
方法详细资料
-
test
Evaluate this predicate on the given request.- 参数:
request- the request to match against- 返回:
trueif the request matches the predicate;falseotherwise
-
and
Return a composed request predicate that tests against both this predicate AND theotherpredicate. When evaluating the composed predicate, if this predicate isfalse, then theotherpredicate is not evaluated.- 参数:
other- a predicate that will be logically-ANDed with this predicate- 返回:
- a predicate composed of this predicate AND the
otherpredicate
-
negate
Return a predicate that represents the logical negation of this predicate.- 返回:
- a predicate that represents the logical negation of this predicate
-
or
Return a composed request predicate that tests against both this predicate OR theotherpredicate. When evaluating the composed predicate, if this predicate istrue, then theotherpredicate is not evaluated.- 参数:
other- a predicate that will be logically-ORed with this predicate- 返回:
- a predicate composed of this predicate OR the
otherpredicate
-
nest
Transform the given request into a request used for a nested route. For instance, a path-based predicate can return aServerRequestwith a path remaining after a match.The default implementation returns an
Optionalwrapping the given request iftest(ServerRequest)evaluates totrue; orOptional.empty()if it evaluates tofalse.- 参数:
request- the request to be nested- 返回:
- the nested request
- 另请参阅:
-
accept
Accept the given visitor. Default implementation callsRequestPredicates.Visitor.unknown(RequestPredicate); composedRequestPredicateimplementations are expected to callacceptfor all components that make up this request predicate.- 参数:
visitor- the visitor to accept
-