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