Class GatewayRequestPredicates
java.lang.Object
org.springframework.cloud.gateway.server.mvc.predicate.GatewayRequestPredicates
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic org.springframework.web.servlet.function.RequestPredicateafter(ZonedDateTime dateTime) static org.springframework.web.servlet.function.RequestPredicatebefore(ZonedDateTime dateTime) static org.springframework.web.servlet.function.RequestPredicatebetween(ZonedDateTime dateTime1, ZonedDateTime dateTime2) static org.springframework.web.servlet.function.RequestPredicatestatic org.springframework.web.servlet.function.RequestPredicatestatic org.springframework.web.servlet.function.RequestPredicatestatic org.springframework.web.servlet.function.RequestPredicatestatic org.springframework.web.servlet.function.RequestPredicatestatic org.springframework.web.servlet.function.RequestPredicateReturn aRequestPredicatethat tests the request host against the given host pattern.static org.springframework.web.servlet.function.RequestPredicateReturn aRequestPredicatethat tests the request host against the given host patterns.hostPredicates(org.springframework.web.util.pattern.PathPatternParser patternParser) Return a function that creates new host-matchingRequestPredicatesfrom pattern Strings using the givenPathPatternParser.static org.springframework.web.servlet.function.RequestPredicatemethod(org.springframework.http.HttpMethod... methods) static org.springframework.web.servlet.function.RequestPredicateReturn aRequestPredicatethat tests the request path against the given path pattern.static org.springframework.web.servlet.function.RequestPredicateReturn aRequestPredicatethat tests the request path against the given path pattern.static org.springframework.web.servlet.function.RequestPredicateReturn aRequestPredicatethat tests the presence of a request parameter.static org.springframework.web.servlet.function.RequestPredicateReturn aRequestPredicatethat tests the presence of a request parameter if the regexp is empty, or, otherwise finds if any value of the parameter matches the regexp.static <T> org.springframework.web.servlet.function.RequestPredicatestatic org.springframework.web.servlet.function.RequestPredicateRequestPredicateto match to the request API version extracted from and parsed with the configuredApiVersionStrategy.static org.springframework.web.servlet.function.RequestPredicateA predicate which will select a route based on its assigned weight.
-
Method Details
-
after
@Shortcut public static org.springframework.web.servlet.function.RequestPredicate after(ZonedDateTime dateTime) -
before
@Shortcut public static org.springframework.web.servlet.function.RequestPredicate before(ZonedDateTime dateTime) -
between
@Shortcut public static org.springframework.web.servlet.function.RequestPredicate between(ZonedDateTime dateTime1, ZonedDateTime dateTime2) -
cloudFoundryRouteService
public static org.springframework.web.servlet.function.RequestPredicate cloudFoundryRouteService() -
cookie
-
cookie
-
header
-
header
-
method
-
host
Return aRequestPredicatethat tests the request host against the given host pattern.- Parameters:
pattern- the host pattern to match- Returns:
- a predicate that tests against the given host pattern
-
host
@Shortcut(type=LIST) public static org.springframework.web.servlet.function.RequestPredicate host(String... patterns) Return aRequestPredicatethat tests the request host against the given host patterns.- Parameters:
patterns- the list of patterns to match- Returns:
- a predicate that tests against the given host patterns
-
hostPredicates
public static Function<String,org.springframework.web.servlet.function.RequestPredicate> hostPredicates(org.springframework.web.util.pattern.PathPatternParser patternParser) Return a function that creates new host-matchingRequestPredicatesfrom pattern Strings using the givenPathPatternParser.This method can be used to specify a non-default, customized
PathPatternParserwhen resolving path patterns.- Parameters:
patternParser- the parser used to parse patterns given to the returned function- Returns:
- a function that resolves a pattern String into a path-matching
RequestPredicatesinstance
-
path
Return aRequestPredicatethat tests the request path against the given path pattern.- Parameters:
pattern- the pattern to match to- Returns:
- a predicate that tests against the given path pattern
-
path
@Shortcut(type=LIST) public static org.springframework.web.servlet.function.RequestPredicate path(String... patterns) Return aRequestPredicatethat tests the request path against the given path pattern.- Parameters:
patterns- the list of patterns to match- Returns:
- a predicate that tests against the given path pattern
-
query
@Shortcut public static org.springframework.web.servlet.function.RequestPredicate query(String param) Return aRequestPredicatethat tests the presence of a request parameter.- Parameters:
param- the name of the query parameter- Returns:
- a predicate that tests for the presence of a given param
-
query
@Shortcut public static org.springframework.web.servlet.function.RequestPredicate query(String param, @Nullable String regexp) Return aRequestPredicatethat tests the presence of a request parameter if the regexp is empty, or, otherwise finds if any value of the parameter matches the regexp.- Parameters:
param- the name of the query parameterregexp- an optional regular expression to match.- Returns:
- a predicate that tests for the given param and regexp.
-
readBody
-
version
@Shortcut public static org.springframework.web.servlet.function.RequestPredicate version(String version) RequestPredicateto match to the request API version extracted from and parsed with the configuredApiVersionStrategy.The version may be one of the following:
- Fixed version ("1.2") -- match this version only.
- Baseline version ("1.2+") -- match this and subsequent versions.
A baseline version allows n endpoint route to continue to work in subsequent versions if it remains compatible until an incompatible change eventually leads to the creation of a new route.
- Parameters:
version- the version to use- Returns:
- the created predicate instance
- Since:
- 5.0
-
weight
@Shortcut public static org.springframework.web.servlet.function.RequestPredicate weight(String group, int weight) A predicate which will select a route based on its assigned weight.- Parameters:
group- the group the route belongs toweight- the weight for the route- Returns:
- a predicate that tests against the given group and weight.
-