public abstract class RequestPredicates extends Object
RequestPredicate that implement various useful
 request matching operations, such as matching based on path, HTTP method, etc.| Modifier and Type | Class and Description | 
|---|---|
| static interface  | RequestPredicates.VisitorReceives notifications from the logical structure of request predicates. | 
| Constructor and Description | 
|---|
| RequestPredicates() | 
| Modifier and Type | Method and Description | 
|---|---|
| static RequestPredicate | accept(MediaType... mediaTypes)Return a  RequestPredicatethat tests if the request's
 accept header is
 compatible with any of the given media types. | 
| static RequestPredicate | all()Return a  RequestPredicatethat always matches. | 
| static RequestPredicate | contentType(MediaType... mediaTypes)Return a  RequestPredicatethat tests if the request's
 content type is
 included by any of the given media types. | 
| static RequestPredicate | DELETE(String pattern)Return a  RequestPredicatethat matches if request's HTTP method isDELETEand the givenpatternmatches against the request path. | 
| static RequestPredicate | GET(String pattern)Return a  RequestPredicatethat matches if request's HTTP method isGETand the givenpatternmatches against the request path. | 
| static RequestPredicate | HEAD(String pattern)Return a  RequestPredicatethat matches if request's HTTP method isHEADand the givenpatternmatches against the request path. | 
| static RequestPredicate | headers(Predicate<ServerRequest.Headers> headersPredicate)Return a  RequestPredicatethat tests the request's headers
 against the given headers predicate. | 
| static RequestPredicate | method(HttpMethod httpMethod)Return a  RequestPredicatethat matches if the request's
 HTTP method is equal to the given method. | 
| static RequestPredicate | methods(HttpMethod... httpMethods)Return a  RequestPredicatethat matches if the request's
 HTTP method is equal to one the of the given methods. | 
| static RequestPredicate | OPTIONS(String pattern)Return a  RequestPredicatethat matches if request's HTTP method isOPTIONSand the givenpatternmatches against the request path. | 
| static RequestPredicate | param(String name,
     Predicate<String> predicate)Return a  RequestPredicatethat tests the request's parameter of the given name
 against the given predicate. | 
| static RequestPredicate | param(String name,
     String value)Return a  RequestPredicatethat matches if the request's parameter of the given name
 has the given value. | 
| static RequestPredicate | PATCH(String pattern)Return a  RequestPredicatethat matches if request's HTTP method isPATCHand the givenpatternmatches against the request path. | 
| static RequestPredicate | path(String pattern)Return a  RequestPredicatethat tests the request path
 against the given path pattern. | 
| static RequestPredicate | pathExtension(Predicate<String> extensionPredicate)Return a  RequestPredicatethat matches if the request's path matches the given
 predicate. | 
| static RequestPredicate | pathExtension(String extension)Return a  RequestPredicatethat matches if the request's path has the given extension. | 
| static Function<String,RequestPredicate> | pathPredicates(PathPatternParser patternParser)Return a function that creates new path-matching  RequestPredicatesfrom pattern Strings using the givenPathPatternParser. | 
| static RequestPredicate | POST(String pattern)Return a  RequestPredicatethat matches if request's HTTP method isPOSTand the givenpatternmatches against the request path. | 
| static RequestPredicate | PUT(String pattern)Return a  RequestPredicatethat matches if request's HTTP method isPUTand the givenpatternmatches against the request path. | 
public static RequestPredicate all()
RequestPredicate that always matches.public static RequestPredicate method(HttpMethod httpMethod)
RequestPredicate that matches if the request's
 HTTP method is equal to the given method.httpMethod - the HTTP method to match againstpublic static RequestPredicate methods(HttpMethod... httpMethods)
RequestPredicate that matches if the request's
 HTTP method is equal to one the of the given methods.httpMethods - the HTTP methods to match againstpublic static RequestPredicate path(String pattern)
RequestPredicate that tests the request path
 against the given path pattern.pattern - the pattern to match topublic static Function<String,RequestPredicate> pathPredicates(PathPatternParser patternParser)
RequestPredicates
 from pattern Strings using the given PathPatternParser.
 This method can be used to specify a non-default, customized
 PathPatternParser when resolving path patterns.
patternParser - the parser used to parse patterns given to the returned functionRequestPredicates instancepublic static RequestPredicate headers(Predicate<ServerRequest.Headers> headersPredicate)
RequestPredicate that tests the request's headers
 against the given headers predicate.headersPredicate - a predicate that tests against the request headerspublic static RequestPredicate contentType(MediaType... mediaTypes)
RequestPredicate that tests if the request's
 content type is
 included by any of the given media types.mediaTypes - the media types to match the request's content type againstpublic static RequestPredicate accept(MediaType... mediaTypes)
RequestPredicate that tests if the request's
 accept header is
 compatible with any of the given media types.mediaTypes - the media types to match the request's accept header againstpublic static RequestPredicate GET(String pattern)
RequestPredicate that matches if request's HTTP method is GET
 and the given pattern matches against the request path.pattern - the path pattern to match againstpublic static RequestPredicate HEAD(String pattern)
RequestPredicate that matches if request's HTTP method is HEAD
 and the given pattern matches against the request path.pattern - the path pattern to match againstpublic static RequestPredicate POST(String pattern)
RequestPredicate that matches if request's HTTP method is POST
 and the given pattern matches against the request path.pattern - the path pattern to match againstpublic static RequestPredicate PUT(String pattern)
RequestPredicate that matches if request's HTTP method is PUT
 and the given pattern matches against the request path.pattern - the path pattern to match againstpublic static RequestPredicate PATCH(String pattern)
RequestPredicate that matches if request's HTTP method is PATCH
 and the given pattern matches against the request path.pattern - the path pattern to match againstpublic static RequestPredicate DELETE(String pattern)
RequestPredicate that matches if request's HTTP method is DELETE
 and the given pattern matches against the request path.pattern - the path pattern to match againstpublic static RequestPredicate OPTIONS(String pattern)
RequestPredicate that matches if request's HTTP method is OPTIONS
 and the given pattern matches against the request path.pattern - the path pattern to match againstpublic static RequestPredicate pathExtension(String extension)
RequestPredicate that matches if the request's path has the given extension.extension - the path extension to match against, ignoring casepublic static RequestPredicate pathExtension(Predicate<String> extensionPredicate)
RequestPredicate that matches if the request's path matches the given
 predicate.extensionPredicate - the predicate to test against the request path extensionpublic static RequestPredicate param(String name, String value)
RequestPredicate that matches if the request's parameter of the given name
 has the given value.name - the name of the parameter to test againstvalue - the value of the parameter to test againstServerRequest.param(String)public static RequestPredicate param(String name, Predicate<String> predicate)
RequestPredicate that tests the request's parameter of the given name
 against the given predicate.name - the name of the parameter to test againstpredicate - the predicate to test against the parameter valueServerRequest.param(String)