Class NettyRoutingFilter
java.lang.Object
org.springframework.cloud.gateway.filter.NettyRoutingFilter
- All Implemented Interfaces:
GlobalFilter, org.springframework.core.Ordered
public class NettyRoutingFilter
extends Object
implements GlobalFilter, org.springframework.core.Ordered
- Author:
- Spencer Gibb, Biju Kunjummen
-
Field Summary
FieldsFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionNettyRoutingFilter(reactor.netty.http.client.HttpClient httpClient, org.springframework.beans.factory.ObjectProvider<List<HttpHeadersFilter>> headersFiltersProvider, HttpClientProperties properties) -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void> filter(org.springframework.web.server.ServerWebExchange exchange, GatewayFilterChain chain) Process the Web request and (optionally) delegate to the nextGatewayFilterthrough the givenGatewayFilterChain.protected io.netty.buffer.ByteBufgetByteBuf(org.springframework.core.io.buffer.DataBuffer dataBuffer) @Nullable List<HttpHeadersFilter> protected reactor.netty.http.client.HttpClientgetHttpClient(Route route, org.springframework.web.server.ServerWebExchange exchange) Creates a new HttpClient with per route timeout configuration.protected reactor.core.publisher.Mono<reactor.netty.http.client.HttpClient> getHttpClientMono(Route route, org.springframework.web.server.ServerWebExchange exchange) Creates a new HttpClient with per route timeout configuration.intgetOrder()
-
Field Details
-
ORDER
public static final int ORDERThe order of the NettyRoutingFilter. SeeOrdered.LOWEST_PRECEDENCE.- See Also:
-
-
Constructor Details
-
NettyRoutingFilter
public NettyRoutingFilter(reactor.netty.http.client.HttpClient httpClient, org.springframework.beans.factory.ObjectProvider<List<HttpHeadersFilter>> headersFiltersProvider, HttpClientProperties properties)
-
-
Method Details
-
getHeadersFilters
-
getOrder
public int getOrder()- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-
filter
public reactor.core.publisher.Mono<Void> filter(org.springframework.web.server.ServerWebExchange exchange, GatewayFilterChain chain) Description copied from interface:GlobalFilterProcess the Web request and (optionally) delegate to the nextGatewayFilterthrough the givenGatewayFilterChain.- Specified by:
filterin interfaceGlobalFilter- Parameters:
exchange- the current server exchangechain- provides a way to delegate to the next filter- Returns:
Mono<Void>to indicate when request processing is complete
-
getByteBuf
protected io.netty.buffer.ByteBuf getByteBuf(org.springframework.core.io.buffer.DataBuffer dataBuffer) -
getHttpClientMono
protected reactor.core.publisher.Mono<reactor.netty.http.client.HttpClient> getHttpClientMono(Route route, org.springframework.web.server.ServerWebExchange exchange) Creates a new HttpClient with per route timeout configuration. Sub-classes that override, should call super.httpClient() if they want to honor the per route timeout configuration.- Parameters:
route- the current route.exchange- the current ServerWebExchange.- Returns:
- the configured HttpClient.
-
getHttpClient
protected reactor.netty.http.client.HttpClient getHttpClient(Route route, org.springframework.web.server.ServerWebExchange exchange) Creates a new HttpClient with per route timeout configuration. Sub-classes that override, should call super.getHttpClient() if they want to honor the per route timeout configuration.- Parameters:
route- the current route.exchange- the current ServerWebExchange.- Returns:
- the configured HttpClient.
-