Class 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 Detail

      • ORDER

        public static final int ORDER
        The order of the NettyRoutingFilter. See Ordered.LOWEST_PRECEDENCE.
        See Also:
        Constant Field Values
    • Constructor Detail

      • NettyRoutingFilter

        public NettyRoutingFilter​(reactor.netty.http.client.HttpClient httpClient,
                                  org.springframework.beans.factory.ObjectProvider<List<HttpHeadersFilter>> headersFiltersProvider,
                                  HttpClientProperties properties)
    • Method Detail

      • getOrder

        public int getOrder()
        Specified by:
        getOrder in interface org.springframework.core.Ordered
      • filter

        public reactor.core.publisher.Mono<Void> filter​(org.springframework.web.server.ServerWebExchange exchange,
                                                        GatewayFilterChain chain)
        Description copied from interface: GlobalFilter
        Process the Web request and (optionally) delegate to the next GatewayFilter through the given GatewayFilterChain.
        Specified by:
        filter in interface GlobalFilter
        Parameters:
        exchange - the current server exchange
        chain - 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)
      • 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.