Top Description Inners Fields Constructors Methods
org.springframework.web.servlet.function

public abstract Class RequestPredicates

extends Object
Class Inheritance
Imports
java.io.IOException, java.net.InetSocketAddress, .URI, java.security.Principal, java.time.Instant, java.util.Arrays, .Collections, .LinkedHashMap, .LinkedHashSet, .List, .Map, .Optional, .Set, java.util.function.Consumer, .Function, .Predicate, jakarta.servlet.ServletException, jakarta.servlet.http.Cookie, .HttpServletRequest, .HttpSession, .Part, org.apache.commons.logging.Log, .LogFactory, org.springframework.core.ParameterizedTypeReference, org.springframework.http.HttpHeaders, .HttpMethod, .MediaType, org.springframework.http.converter.HttpMessageConverter, org.springframework.http.server.PathContainer, .RequestPath, org.springframework.lang.Nullable, org.springframework.util.Assert, .CollectionUtils, .MimeTypeUtils, .MultiValueMap, org.springframework.validation.BindException, org.springframework.web.bind.WebDataBinder, org.springframework.web.cors.CorsUtils, org.springframework.web.util.UriBuilder, .UriUtils, org.springframework.web.util.pattern.PathPattern, .PathPatternParser

Implementations of RequestPredicate that implement various useful request matching operations, such as matching based on path, HTTP method, etc.
Authors
Arjen Poutsma, Sam Brannen
Since
5.2

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
RequestPredicates.AndRequestPredicate

RequestPredicate for where both left and right predicates must match.

private abstract static class
private static class
private static class
private static class
private static class
private static class
pack-priv static class
private static class
pack-priv static class
RequestPredicates.OrRequestPredicate

RequestPredicate where either left or right predicates may match.

private static class
private static class
private static class
private abstract static class
RequestPredicates.RequestModifyingPredicate

Extension of RequestPredicate that can modify the ServerRequest.

private static class
private static class
private static class
public static interface
RequestPredicates.Visitor

Receives notifications from the logical structure of request predicates.

Field Summary

Modifier and TypeField and Description
private static final Log

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static RequestPredicate

Returns:

a predicate that tests the request's accept header against the given media types
accept
(MediaType...
the media types to match the request's accept header against
mediaTypes
)

Return a RequestPredicate that tests if the request's accept header is compatible with any of the given media types.

public static RequestPredicate

Returns:

a predicate that always matches
all
()

Return a RequestPredicate that always matches.

public static RequestPredicate

Returns:

a predicate that tests the request's content type against the given media types
contentType
(MediaType...
the media types to match the request's content type against
mediaTypes
)

Return a RequestPredicate that tests if the request's content type is included by any of the given media types.

public static RequestPredicate

Returns:

a predicate that matches if the request method is DELETE and if the given pattern matches against the request path
DELETE
(String
the path pattern to match against
pattern
)

Return a RequestPredicate that matches if request's HTTP method is DELETE and the given pattern matches against the request path.

public static RequestPredicate

Returns:

a predicate that matches if the request method is GET and if the given pattern matches against the request path
GET
(String
the path pattern to match against
pattern
)

Return a RequestPredicate that matches if request's HTTP method is GET and the given pattern matches against the request path.

public static RequestPredicate

Returns:

a predicate that matches if the request method is HEAD and if the given pattern matches against the request path
HEAD
(String
the path pattern to match against
pattern
)

Return a RequestPredicate that matches if request's HTTP method is HEAD and the given pattern matches against the request path.

public static RequestPredicate

Returns:

a predicate that tests against the given header predicate
headers
(Predicate<ServerRequest.Headers>
a predicate that tests against the request headers
headersPredicate
)

Return a RequestPredicate that tests the request's headers against the given headers predicate.

private static <K, V> Map<K, V>
mergeMaps(Map<K, V> left, Map<K, V> right)

private static PathPattern
mergePatterns(PathPattern oldPattern, PathPattern newPattern)

public static RequestPredicate

Returns:

a predicate that tests against the given HTTP method
method
(HttpMethod
the HTTP method to match against
httpMethod
)

Return a RequestPredicate that matches if the request's HTTP method is equal to the given method.

public static RequestPredicate

Returns:

a predicate that tests against the given HTTP methods
methods
(HttpMethod...
the HTTP methods to match against
httpMethods
)

Return a RequestPredicate that matches if the request's HTTP method is equal to one the of the given methods.

public static RequestPredicate

Returns:

a predicate that matches if the request method is OPTIONS and if the given pattern matches against the request path
OPTIONS
(String
the path pattern to match against
pattern
)

Return a RequestPredicate that matches if request's HTTP method is OPTIONS and the given pattern matches against the request path.

public static RequestPredicate

Returns:

a predicate that matches if the parameter has the given value
param
(String
the name of the parameter to test against
name
,
String
the value of the parameter to test against
value
)

Return a RequestPredicate that matches if the request's parameter of the given name has the given value.

public static RequestPredicate

Returns:

a predicate that matches the given predicate against the parameter of the given name
param
(String
the name of the parameter to test against
name
,
Predicate<String>
the predicate to test against the parameter value
predicate
)

Return a RequestPredicate that tests the request's parameter of the given name against the given predicate.

public static RequestPredicate

Returns:

a predicate that matches if the request method is PATCH and if the given pattern matches against the request path
PATCH
(String
the path pattern to match against
pattern
)

Return a RequestPredicate that matches if request's HTTP method is PATCH and the given pattern matches against the request path.

public static RequestPredicate

Returns:

a predicate that tests against the given path pattern
path
(String
the pattern to match to
pattern
)

Return a RequestPredicate that tests the request path against the given path pattern.

public static RequestPredicate

Returns:

a predicate that matches if the request's path has the given file extension
pathExtension
(String
the path extension to match against, ignoring case
extension
)

Return a RequestPredicate that matches if the request's path has the given extension.

public static RequestPredicate

Returns:

a predicate that matches if the given predicate matches against the request's path file extension
pathExtension
(Predicate<String>
the predicate to test against the request path extension
extensionPredicate
)

Return a RequestPredicate that matches if the request's path matches the given predicate.

public static Function<String, RequestPredicate>

Returns:

a function that resolves a pattern String into a path-matching RequestPredicates instance
pathPredicates
(PathPatternParser
the parser used to parse patterns given to the returned function
patternParser
)

Return a function that creates new path-matching RequestPredicates from pattern Strings using the given PathPatternParser.

public static RequestPredicate

Returns:

a predicate that matches if the request method is POST and if the given pattern matches against the request path
POST
(String
the path pattern to match against
pattern
)

Return a RequestPredicate that matches if request's HTTP method is POST and the given pattern matches against the request path.

public static RequestPredicate

Returns:

a predicate that matches if the request method is PUT and if the given pattern matches against the request path
PUT
(String
the path pattern to match against
pattern
)

Return a RequestPredicate that matches if request's HTTP method is PUT and the given pattern matches against the request path.

private static void
traceMatch(String prefix, Object desired, Object actual, boolean match)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait