From 8edbc181c93a9c5c9cf768286ce31089b929b400 Mon Sep 17 00:00:00 2001 From: buildmaster Date: Tue, 11 Dec 2018 02:28:01 +0000 Subject: [PATCH] Sync docs from master to gh-pages --- multi/multi_gateway-request-predicates-factories.html | 4 +++- single/spring-cloud-gateway.html | 4 +++- spring-cloud-gateway.xml | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/multi/multi_gateway-request-predicates-factories.html b/multi/multi_gateway-request-predicates-factories.html index bbaf6cf6..e7248e8f 100644 --- a/multi/multi_gateway-request-predicates-factories.html +++ b/multi/multi_gateway-request-predicates-factories.html @@ -72,7 +72,9 @@ uri: http://example.org predicates: - Path=/foo/{segment},/bar/{segment}

-

This route would match if the request path was, for example: /foo/1 or /foo/bar or /bar/baz.

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 GatewayFilter Factories

4.9 Query Route Predicate Factory

The Query Route Predicate Factory takes two parameters: a required param and an optional regexp.

application.yml.  +

This route would match if the request path was, for example: /foo/1 or /foo/bar or /bar/baz.

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 GatewayFilter Factories

A utility method is available to make access to these variables easier.

Map<String, String> uriVariables = ServerWebExchangeUtils.getPathPredicateVariables(exchange);
+
+String segment = uriVariables.get("segment");

4.9 Query Route Predicate Factory

The Query Route Predicate Factory takes two parameters: a required param and an optional regexp.

application.yml. 

spring:
   cloud:
     gateway:
diff --git a/single/spring-cloud-gateway.html b/single/spring-cloud-gateway.html
index ca2704b3..0564ed4f 100644
--- a/single/spring-cloud-gateway.html
+++ b/single/spring-cloud-gateway.html
@@ -74,7 +74,9 @@ for details on setting up your build system with the current Spring Cloud Releas
         uri: http://example.org
         predicates:
         - Path=/foo/{segment},/bar/{segment}

-

This route would match if the request path was, for example: /foo/1 or /foo/bar or /bar/baz.

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 GatewayFilter Factories

4.9 Query Route Predicate Factory

The Query Route Predicate Factory takes two parameters: a required param and an optional regexp.

application.yml.  +

This route would match if the request path was, for example: /foo/1 or /foo/bar or /bar/baz.

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 GatewayFilter Factories

A utility method is available to make access to these variables easier.

Map<String, String> uriVariables = ServerWebExchangeUtils.getPathPredicateVariables(exchange);
+
+String segment = uriVariables.get("segment");

4.9 Query Route Predicate Factory

The Query Route Predicate Factory takes two parameters: a required param and an optional regexp.

application.yml. 

spring:
   cloud:
     gateway:
diff --git a/spring-cloud-gateway.xml b/spring-cloud-gateway.xml
index a54ca14b..69086e3e 100644
--- a/spring-cloud-gateway.xml
+++ b/spring-cloud-gateway.xml
@@ -197,6 +197,10 @@ for details on setting up your build system with the current Spring Cloud Releas
 
 This route would match if the request path was, for example: /foo/1 or /foo/bar or /bar/baz.
 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 GatewayFilter Factories
+A utility method is available to make access to these variables easier.
+Map<String, String> uriVariables = ServerWebExchangeUtils.getPathPredicateVariables(exchange);
+
+String segment = uriVariables.get("segment");
 
 
Query Route Predicate Factory