Interface ZuulFilter<I extends ZuulMessage,O extends ZuulMessage>

All Superinterfaces:
ShouldFilter<I>
All Known Subinterfaces:
SyncZuulFilter<I,O>
All Known Implementing Classes:
BaseFilter, BaseSyncFilter, Endpoint, GZipResponseFilter, HttpInboundFilter, HttpInboundSyncFilter, HttpOutboundFilter, HttpOutboundSyncFilter, HttpSyncEndpoint, InboundPassportStampingFilter, MissingEndpointHandlingFilter, OutboundPassportStampingFilter, PassportStampingFilter, ProxyEndpoint, SurgicalDebugFilter, SyncZuulFilterAdapter

public interface ZuulFilter<I extends ZuulMessage,O extends ZuulMessage> extends ShouldFilter<I>
Base interface for ZuulFilters
  • Method Summary

    Modifier and Type
    Method
    Description
    rx.Observable<O>
    applyAsync(I input)
    if shouldFilter() is true, this method will be invoked.
    Classify a filter by category.
    void
    Called by zuul filter after request is processed by this filter.
     
    default int
    filterOrder() must also be defined for a filter.
    default FilterType
    to classify a filter by type.
    Choose a default message to use if the applyAsync() method throws an exception.
     
    void
    Called by zuul filter runner before sending request through this filter.
    boolean
     
    boolean
    Filter indicates it needs to read and buffer whole body before it can operate on the messages by returning true.
    boolean
    Whether this filter's shouldFilter() method should be checked, and apply() called, even if SessionContext.stopFilterProcessing has been set.
    io.netty.handler.codec.http.HttpContent
    processContentChunk(ZuulMessage zuulMessage, io.netty.handler.codec.http.HttpContent chunk)
    Optionally transform HTTP content chunk received.

    Methods inherited from interface com.netflix.zuul.filters.ShouldFilter

    shouldFilter
  • Method Details

    • isDisabled

      boolean isDisabled()
    • filterName

      String filterName()
    • filterOrder

      default int filterOrder()
      filterOrder() must also be defined for a filter. Filters may have the same filterOrder if precedence is not important for a filter. filterOrders do not need to be sequential.
      Returns:
      the int order of a filter
    • filterType

      default FilterType filterType()
      to classify a filter by type. Standard types in Zuul are "in" for pre-routing filtering, "end" for routing to an origin, "out" for post-routing filters.
      Returns:
      FilterType
    • category

      default FilterCategory category()
      Classify a filter by category.
      Returns:
      FilterCategory the classification of this filter
    • overrideStopFilterProcessing

      boolean overrideStopFilterProcessing()
      Whether this filter's shouldFilter() method should be checked, and apply() called, even if SessionContext.stopFilterProcessing has been set.
      Returns:
      boolean
    • incrementConcurrency

      void incrementConcurrency() throws ZuulFilterConcurrencyExceededException
      Called by zuul filter runner before sending request through this filter. The filter can throw ZuulFilterConcurrencyExceededException if it has reached its concurrent requests limit and does not wish to process the request. Generally only useful for async filters.
      Throws:
      ZuulFilterConcurrencyExceededException
    • applyAsync

      rx.Observable<O> applyAsync(I input)
      if shouldFilter() is true, this method will be invoked. this method is the core method of a ZuulFilter
    • decrementConcurrency

      void decrementConcurrency()
      Called by zuul filter after request is processed by this filter.
    • getSyncType

      default FilterSyncType getSyncType()
    • getDefaultOutput

      O getDefaultOutput(I input)
      Choose a default message to use if the applyAsync() method throws an exception.
      Returns:
      ZuulMessage
    • needsBodyBuffered

      boolean needsBodyBuffered(I input)
      Filter indicates it needs to read and buffer whole body before it can operate on the messages by returning true. The decision can be made at runtime, looking at the request type. For example if the incoming message is a MSL message MSL decryption filter can return true here to buffer whole MSL message before it tries to decrypt it.
      Returns:
      true if this filter needs to read whole body before it can run, false otherwise
    • processContentChunk

      io.netty.handler.codec.http.HttpContent processContentChunk(ZuulMessage zuulMessage, io.netty.handler.codec.http.HttpContent chunk)
      Optionally transform HTTP content chunk received.