Browse Source

Merge branch '2.0.x'

pull/558/head
Spencer Gibb 6 years ago
parent
commit
f2cc3f8d0b
No known key found for this signature in database
GPG Key ID: 7788A47380690861
  1. 10
      spring-cloud-gateway-core/src/main/java/org/springframework/cloud/gateway/handler/FilteringWebHandler.java
  2. 5
      spring-cloud-gateway-core/src/main/java/org/springframework/cloud/gateway/handler/RoutePredicateHandlerMapping.java

10
spring-cloud-gateway-core/src/main/java/org/springframework/cloud/gateway/handler/FilteringWebHandler.java

@ -23,7 +23,10 @@ import java.util.stream.Collectors; @@ -23,7 +23,10 @@ import java.util.stream.Collectors;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import reactor.core.publisher.Mono;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.cloud.gateway.filter.OrderedGatewayFilter;
import org.springframework.cloud.gateway.filter.factory.GatewayFilterFactory;
@ -31,13 +34,10 @@ import org.springframework.cloud.gateway.route.Route; @@ -31,13 +34,10 @@ import org.springframework.cloud.gateway.route.Route;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.web.server.WebHandler;
import static org.springframework.cloud.gateway.support.ServerWebExchangeUtils.GATEWAY_ROUTE_ATTR;
import reactor.core.publisher.Mono;
/**
* WebHandler that delegates to a chain of {@link GlobalFilter} instances and
* {@link GatewayFilterFactory} instances then to the target {@link WebHandler}.
@ -82,7 +82,9 @@ public class FilteringWebHandler implements WebHandler { @@ -82,7 +82,9 @@ public class FilteringWebHandler implements WebHandler {
//TODO: needed or cached?
AnnotationAwareOrderComparator.sort(combined);
logger.debug("Sorted gatewayFilterFactories: "+ combined);
if (logger.isDebugEnabled()) {
logger.debug("Sorted gatewayFilterFactories: "+ combined);
}
return new DefaultGatewayFilterChain(combined).filter(exchange);
}

5
spring-cloud-gateway-core/src/main/java/org/springframework/cloud/gateway/handler/RoutePredicateHandlerMapping.java

@ -61,7 +61,7 @@ public class RoutePredicateHandlerMapping extends AbstractHandlerMapping { @@ -61,7 +61,7 @@ public class RoutePredicateHandlerMapping extends AbstractHandlerMapping {
if (managmentPort != null && exchange.getRequest().getURI().getPort() == managmentPort.intValue()) {
return Mono.empty();
}
exchange.getAttributes().put(GATEWAY_HANDLER_MAPPER_ATTR, getClass().getSimpleName());
exchange.getAttributes().put(GATEWAY_HANDLER_MAPPER_ATTR, getSimpleName());
return lookupRoute(exchange)
// .log("route-predicate-handler-mapping", Level.FINER) //name this
@ -146,4 +146,7 @@ public class RoutePredicateHandlerMapping extends AbstractHandlerMapping { @@ -146,4 +146,7 @@ public class RoutePredicateHandlerMapping extends AbstractHandlerMapping {
protected void validateRoute(Route route, ServerWebExchange exchange) {
}
protected String getSimpleName() {
return "RoutePredicateHandlerMapping";
}
}

Loading…
Cancel
Save