Merge branch '2.0.x'
This commit is contained in:
@@ -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;
|
||||
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 {
|
||||
//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);
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
protected void validateRoute(Route route, ServerWebExchange exchange) {
|
||||
}
|
||||
|
||||
protected String getSimpleName() {
|
||||
return "RoutePredicateHandlerMapping";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user