public abstract class RequestPredicates extends Object
RequestPredicate
that implement various useful request matching operations, such as
matching based on path, HTTP method, etc.Constructor and Description |
---|
RequestPredicates() |
Modifier and Type | Method and Description |
---|---|
static RequestPredicate |
accept(MediaType... mediaTypes)
Return a
RequestPredicate that tests if the request's
accept header is
compatible with any of the given media types. |
static RequestPredicate |
all()
Returns a
RequestPredicate that always matches. |
static RequestPredicate |
contentType(MediaType... mediaTypes)
Return a
RequestPredicate that tests if the request's
content type is included
by any of the given media types. |
static RequestPredicate |
DELETE(String pattern)
Return a
RequestPredicate that matches if request's HTTP method is DELETE and the given
pattern matches against the request path. |
static RequestPredicate |
GET(String pattern)
Return a
RequestPredicate that matches if request's HTTP method is GET and the given
pattern matches against the request path. |
static RequestPredicate |
HEAD(String pattern)
Return a
RequestPredicate that matches if request's HTTP method is HEAD and the given
pattern matches against the request path. |
static RequestPredicate |
headers(Predicate<Request.Headers> headersPredicate)
Return a
RequestPredicate that tests the request's headers against the given headers predicate. |
static RequestPredicate |
method(HttpMethod httpMethod)
Return a
RequestPredicate that tests against the given HTTP method. |
static RequestPredicate |
OPTIONS(String pattern)
Return a
RequestPredicate that matches if request's HTTP method is OPTIONS and the given
pattern matches against the request path. |
static RequestPredicate |
PATCH(String pattern)
Return a
RequestPredicate that matches if request's HTTP method is PATCH and the given
pattern matches against the request path. |
static RequestPredicate |
path(String pattern)
Return a
RequestPredicate that tests against the given path pattern. |
static RequestPredicate |
path(String pattern,
PathMatcher pathMatcher)
Return a
RequestPredicate that tests against the given path pattern using the given matcher. |
static RequestPredicate |
POST(String pattern)
Return a
RequestPredicate that matches if request's HTTP method is POST and the given
pattern matches against the request path. |
static RequestPredicate |
PUT(String pattern)
Return a
RequestPredicate that matches if request's HTTP method is PUT and the given
pattern matches against the request path. |
public static RequestPredicate all()
RequestPredicate
that always matches.public static RequestPredicate method(HttpMethod httpMethod)
RequestPredicate
that tests against the given HTTP method.httpMethod
- the HTTP method to match topublic static RequestPredicate path(String pattern)
RequestPredicate
that tests against the given path pattern.pattern
- the pattern to match topublic static RequestPredicate path(String pattern, PathMatcher pathMatcher)
RequestPredicate
that tests against the given path pattern using the given matcher.pattern
- the pattern to match topathMatcher
- the path matcher to usepublic static RequestPredicate headers(Predicate<Request.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 against