public class PredicateSpec extends UriSpec
Modifier and Type | Method and Description |
---|---|
BooleanSpec |
after(ZonedDateTime datetime)
A predicate to check if a request was made after a specific
ZonedDateTime |
BooleanSpec |
alwaysTrue()
A predicate which is always true
|
BooleanSpec |
asyncPredicate(AsyncPredicate<org.springframework.web.server.ServerWebExchange> predicate) |
BooleanSpec |
before(ZonedDateTime datetime)
A predicate to check if a request was made before a specific
ZonedDateTime |
BooleanSpec |
between(ZonedDateTime datetime1,
ZonedDateTime datetime2)
A predicate to check if a request was made between two
ZonedDateTime s |
BooleanSpec |
cloudFoundryRouteService() |
BooleanSpec |
cookie(String name,
String regex)
A predicate that checks if a cookie matches a given regular expression
|
protected GatewayFilterSpec |
createGatewayFilterSpec() |
BooleanSpec |
header(String header)
A predicate that checks if a given header is present on the request
|
BooleanSpec |
header(String header,
String regex)
A predicate that checks if a given headers has a value which matches a regular
expression
|
BooleanSpec |
host(String... pattern)
A predicate that checks if the
host header matches a given pattern |
BooleanSpec |
method(org.springframework.http.HttpMethod method)
A predicate that checks if the HTTP method matches
|
BooleanSpec |
method(String method)
A predicate that checks if the HTTP method matches
|
PredicateSpec |
order(int order) |
BooleanSpec |
path(boolean matchOptionalTrailingSeparator,
String... patterns)
A predicate that checks if the path of the request matches the given pattern
|
BooleanSpec |
path(String... patterns)
A predicate that checks if the path of the request matches the given pattern
|
BooleanSpec |
path(String pattern,
boolean matchOptionalTrailingSeparator)
Deprecated.
|
BooleanSpec |
predicate(Predicate<org.springframework.web.server.ServerWebExchange> predicate) |
BooleanSpec |
query(String param)
A predicate that checks if a given query parameter is present in the request URL
|
BooleanSpec |
query(String param,
String regex)
A predicate that checks if a query parameter matches a regular expression
|
<T> BooleanSpec |
readBody(Class<T> inClass,
Predicate<T> predicate)
This predicate is BETA and may be subject to change in a future release.
|
BooleanSpec |
remoteAddr(RemoteAddressResolver resolver,
String... addrs)
A predicate which checks the remote address of the request.
|
BooleanSpec |
remoteAddr(String... addrs)
A predicate which checks the remote address of the request.
|
BooleanSpec |
weight(String group,
int weight)
A predicate which will select a route based on its assigned weight.
|
public PredicateSpec order(int order)
public BooleanSpec predicate(Predicate<org.springframework.web.server.ServerWebExchange> predicate)
public BooleanSpec asyncPredicate(AsyncPredicate<org.springframework.web.server.ServerWebExchange> predicate)
protected GatewayFilterSpec createGatewayFilterSpec()
public BooleanSpec after(ZonedDateTime datetime)
ZonedDateTime
datetime
- requests would only be routed after this ZonedDateTime
BooleanSpec
to be used to add logical operatorspublic BooleanSpec before(ZonedDateTime datetime)
ZonedDateTime
datetime
- requests will only be routed before this ZonedDateTime
BooleanSpec
to be used to add logical operatorspublic BooleanSpec between(ZonedDateTime datetime1, ZonedDateTime datetime2)
ZonedDateTime
sdatetime1
- the request must have been made after this ZonedDateTime
datetime2
- the request must be made before this ZonedDateTime
BooleanSpec
to be used to add logical operatorspublic BooleanSpec cookie(String name, String regex)
name
- the name of the cookieregex
- the value of the cookies will be evaluated against this regular
expressionBooleanSpec
to be used to add logical operatorspublic BooleanSpec header(String header)
header
- the header name to checkBooleanSpec
to be used to add logical operatorspublic BooleanSpec header(String header, String regex)
header
- the header name to checkregex
- the regular expression to check againstBooleanSpec
to be used to add logical operatorspublic BooleanSpec host(String... pattern)
host
header matches a given patternpattern
- the pattern to check against. The pattern is an Ant style pattern
with .
as a separatorBooleanSpec
to be used to add logical operatorspublic BooleanSpec method(String method)
method
- the name of the HTTP methodBooleanSpec
to be used to add logical operatorspublic BooleanSpec method(org.springframework.http.HttpMethod method)
method
- the HTTP methodBooleanSpec
to be used to add logical operatorspublic BooleanSpec path(String... patterns)
patterns
- the pattern to check the path against. The pattern is a
PathMatcher
patternBooleanSpec
to be used to add logical operators@Deprecated public BooleanSpec path(String pattern, boolean matchOptionalTrailingSeparator)
pattern
- the pattern to check the path against. The pattern is a
PathMatcher
patternmatchOptionalTrailingSeparator
- set to false if you do not want this path to
match when there is a trailing /
BooleanSpec
to be used to add logical operatorspublic BooleanSpec path(boolean matchOptionalTrailingSeparator, String... patterns)
patterns
- the pattern to check the path against. The pattern is a
PathMatcher
patternmatchOptionalTrailingSeparator
- set to false if you do not want this path to
match when there is a trailing /
BooleanSpec
to be used to add logical operatorspublic <T> BooleanSpec readBody(Class<T> inClass, Predicate<T> predicate)
T
- the type the body is parsed toinClass
- the class to parse the body topredicate
- a predicate to check the contents of the bodyBooleanSpec
to be used to add logical operatorspublic BooleanSpec query(String param, String regex)
param
- the query parameter nameregex
- the regular expression to evaluate the query parameter value againstBooleanSpec
to be used to add logical operatorspublic BooleanSpec query(String param)
param
- the query parameter nameBooleanSpec
to be used to add logical operatorspublic BooleanSpec remoteAddr(String... addrs)
remoteAddr(RemoteAddressResolver, String...)
to customize the
resolver. You can customize the way that the remote address is resolved by setting
a custom RemoteAddressResolver.addrs
- the remote address to verify. Should use CIDR-notation (IPv4 or IPv6)
strings.BooleanSpec
to be used to add logical operatorspublic BooleanSpec remoteAddr(RemoteAddressResolver resolver, String... addrs)
X-Forwarded-For
header,
XForwardedRemoteAddressResolver
.
See
XForwardedRemoteAddressResolver
for more information.resolver
- the RemoteAddressResolver
to use to resolve the remote IP
address againstaddrs
- the remote address to verify. Should use CIDR-notation (IPv4 or IPv6)
strings.BooleanSpec
to be used to add logical operatorspublic BooleanSpec weight(String group, int weight)
group
- the group the route belongs toweight
- the weight for the routeBooleanSpec
to be used to add logical operatorspublic BooleanSpec cloudFoundryRouteService()
public BooleanSpec alwaysTrue()
BooleanSpec
to be used to add logical operatorsCopyright © 2019 Pivotal Software, Inc.. All rights reserved.