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

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The order of the NettyRoutingFilter.

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
    NettyRoutingFilter(reactor.netty.http.client.HttpClient httpClient, org.springframework.beans.factory.ObjectProvider<List<HttpHeadersFilter>> headersFiltersProvider, HttpClientProperties properties)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    reactor.core.publisher.Mono<Void>
    filter(org.springframework.web.server.ServerWebExchange exchange, GatewayFilterChain chain)
    Process the Web request and (optionally) delegate to the next GatewayFilter through the given GatewayFilterChain.
    protected io.netty.buffer.ByteBuf
    getByteBuf(org.springframework.core.io.buffer.DataBuffer dataBuffer)
     
     
    protected reactor.netty.http.client.HttpClient
    getHttpClient(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.
    int
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ORDER

      public static final int ORDER
      The order of the NettyRoutingFilter. See Ordered.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

      public @Nullable List<HttpHeadersFilter> getHeadersFilters()
    • 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)
    • 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.