From 6600555881ea408209fc3e89102972802c8377f7 Mon Sep 17 00:00:00 2001 From: spencergibb Date: Thu, 19 Jan 2023 14:11:31 -0500 Subject: [PATCH] Clarifies scope of GlobalFilter to matched routes. Fixes gh-2784 --- .../cloud/gateway/filter/GatewayFilterChain.java | 5 +++-- .../springframework/cloud/gateway/filter/GlobalFilter.java | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/filter/GatewayFilterChain.java b/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/filter/GatewayFilterChain.java index 2c8a86c5f..6c6b3cc7c 100644 --- a/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/filter/GatewayFilterChain.java +++ b/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/filter/GatewayFilterChain.java @@ -22,15 +22,16 @@ import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.WebFilter; /** - * Contract to allow a {@link WebFilter} to delegate to the next in the chain. + * Contract to allow a {@link GatewayFilter} to delegate to the next in the chain. * + * Copied from framework WebFilterChain * @author Rossen Stoyanchev * @since 5.0 */ public interface GatewayFilterChain { /** - * Delegate to the next {@code WebFilter} in the chain. + * Delegate to the next {@code GatewayFilter} in the chain. * @param exchange the current server exchange * @return {@code Mono} to indicate when request handling is complete */ diff --git a/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/filter/GlobalFilter.java b/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/filter/GlobalFilter.java index 96f87091f..dde4ea8ec 100644 --- a/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/filter/GlobalFilter.java +++ b/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/filter/GlobalFilter.java @@ -21,17 +21,20 @@ import reactor.core.publisher.Mono; import org.springframework.web.server.ServerWebExchange; /** - * Contract for interception-style, chained processing of Web requests that may be used to + * Contract for interception-style, chained processing of gateway requests that may be used to * implement cross-cutting, application-agnostic requirements such as security, timeouts, * and others. * + * Only applies to matched gateway routes. + * + * Copied from framework WebFilter * @author Rossen Stoyanchev * @since 5.0 */ public interface GlobalFilter { /** - * Process the Web request and (optionally) delegate to the next {@code WebFilter} + * Process the Web request and (optionally) delegate to the next {@code GatewayFilter} * through the given {@link GatewayFilterChain}. * @param exchange the current server exchange * @param chain provides a way to delegate to the next filter