Move back to Predicate<ServerWebExchange>

Stick to webflux class as this project is currently built on webflux.

fixes gh-35
This commit is contained in:
Spencer Gibb
2017-03-22 12:01:27 -06:00
parent 34c35fbcc9
commit b9bf99451f
37 changed files with 417 additions and 585 deletions

View File

@@ -30,21 +30,21 @@ TODO: document the meaning of terms to follow, like Route, Predicate and Filter
TODO: give an overview of how the gateway works with maybe a ascii diagram
[[gateway-request-predicates-factories]]
== Request Predicate Factories
== Route Predicate Factories
Spring Cloud Gateway matches routes as part of the Spring WebFlux `HandlerMapping` infrastructure. Spring Cloud Gateway includes many built-in Request Predicate Factorys. All of these predicates match on different attributes of the HTTP request. Multiple Request Predicate Factorys can be combined and are combined via logical `and`.
Spring Cloud Gateway matches routes as part of the Spring WebFlux `HandlerMapping` infrastructure. Spring Cloud Gateway includes many built-in Route Predicate Factorys. All of these predicates match on different attributes of the HTTP request. Multiple Route Predicate Factorys can be combined and are combined via logical `and`.
=== After Request Predicate Factory
TODO: document After Request Predicate Factory
=== After Route Predicate Factory
TODO: document After Route Predicate Factory
=== Before Request Predicate Factory
TODO: document Before Request Predicate Factory
=== Before Route Predicate Factory
TODO: document Before Route Predicate Factory
=== Between Request Predicate Factory
TODO: document Between Request Predicate Factory
=== Between Route Predicate Factory
TODO: document Between Route Predicate Factory
=== Cookie Request Predicate Factory
The Cookie Request Predicate Factory takes two parameters, the cookie name and a regular expression. This predicate matches cookies that have the given name and the value matches the regular expression.
=== Cookie Route Predicate Factory
The Cookie Route Predicate Factory takes two parameters, the cookie name and a regular expression. This predicate matches cookies that have the given name and the value matches the regular expression.
.application.yml
[source,yaml]
@@ -62,8 +62,8 @@ spring:
This route matches the request has a cookie named `chocolate` who's value matches the `ch.p` regular expression.
=== Header Request Predicate Factory
The Header Request Predicate Factory takes two parameters, the header name and a regular expression. This predicate matches with a header that has the given name and the value matches the regular expression.
=== Header Route Predicate Factory
The Header Route Predicate Factory takes two parameters, the header name and a regular expression. This predicate matches with a header that has the given name and the value matches the regular expression.
.application.yml
[source,yaml]
@@ -81,8 +81,8 @@ spring:
This route matches if the request has a header named `X-Request-Id` whos value matches the `\d+` regular expression (has a value of one or more digits).
=== Host Request Predicate Factory
The Host Request Predicate Factory takes one parameter: the host name pattern. The pattern is an Ant style pattern with `.` as the separator. This predicates matches the `Host` header that matches the pattern.
=== Host Route Predicate Factory
The Host Route Predicate Factory takes one parameter: the host name pattern. The pattern is an Ant style pattern with `.` as the separator. This predicates matches the `Host` header that matches the pattern.
.application.yml
[source,yaml]
@@ -101,8 +101,8 @@ spring:
This route would match if the request has a `Host` header has the value `www.somehost.org` or `beta.somehost.org`.
=== Method Request Predicate Factory
The Method Request Predicate Factory takes one parameter: the HTTP method to match.
=== Method Route Predicate Factory
The Method Route Predicate Factory takes one parameter: the HTTP method to match.
.application.yml
[source,yaml]
@@ -120,8 +120,8 @@ spring:
This route would match if the request method was a `GET`.
=== Path Request Predicate Factory
The Path Request Predicate Factory takes one parameter: a Spring `PathMatcher` pattern.
=== Path Route Predicate Factory
The Path Route Predicate Factory takes one parameter: a Spring `PathMatcher` pattern.
.application.yml
[source,yaml]
@@ -141,11 +141,11 @@ This route would match if the request path was, for example: `/foo/1` or `/foo/b
This predicate extracts the URI template variables (like `segment` defined in the example above) as a map of names and values and places it in the `ServerWebExchange.getAttributes()` with a key defined in `PathRoutePredicate.URL_PREDICATE_VARS_ATTR`. Those values are then available for use by <<gateway-route-filters,WebFilter Factorys>>
=== Query Request Predicate Factory
TODO: document Query Request Predicate Factory
=== Query Route Predicate Factory
TODO: document Query Route Predicate Factory
=== RemoteAddr Request Predicate Factory
TODO: document RemoteAddr Request Predicate Factory
=== RemoteAddr Route Predicate Factory
TODO: document RemoteAddr Route Predicate Factory
[[gateway-route-filters]]
== WebFilter Factorys
@@ -210,9 +210,9 @@ TODO: document the `/gateway` actuator endpoint
TODO: overview of writing custom integrations
=== Writing Custom Request Predicate Factorys
=== Writing Custom Route Predicate Factorys
TODO: document writing Custom Request Predicate Factorys
TODO: document writing Custom Route Predicate Factorys
=== Writing Custom WebFilter Factorys