Package feign

Class Feign.Builder

  • Enclosing class:
    Feign

    public static class Feign.Builder
    extends java.lang.Object
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • decode404

        public Feign.Builder decode404()
        This flag indicates that the decoder should process responses with 404 status, specifically returning null or empty instead of throwing FeignException.

        All first-party (ex gson) decoders return well-known empty values defined by Util.emptyValueOf(java.lang.reflect.Type). To customize further, wrap an existing decoder or make your own.

        This flag only works with 404, as opposed to all or arbitrary status codes. This was an explicit decision: 404 -> empty is safe, common and doesn't complicate redirection, retry or fallback policy. If your server returns a different status for not-found, correct via a custom client.

        Since:
        8.12
      • requestInterceptor

        public Feign.Builder requestInterceptor​(RequestInterceptor requestInterceptor)
        Adds a single request interceptor to the builder.
      • requestInterceptors

        public Feign.Builder requestInterceptors​(java.lang.Iterable<RequestInterceptor> requestInterceptors)
        Sets the full set of request interceptors for the builder, overwriting any previous interceptors.
      • invocationHandlerFactory

        public Feign.Builder invocationHandlerFactory​(InvocationHandlerFactory invocationHandlerFactory)
        Allows you to override how reflective dispatch works inside of Feign.
      • doNotCloseAfterDecode

        public Feign.Builder doNotCloseAfterDecode()
        This flag indicates that the response should not be automatically closed upon completion of decoding the message. This should be set if you plan on processing the response into a lazy-evaluated construct, such as a Iterator.

        Feign standard decoders do not have built in support for this flag. If you are using this flag, you MUST also use a custom Decoder, and be sure to close all resources appropriately somewhere in the Decoder (you can use Util.ensureClosed(java.io.Closeable) for convenience).
        Since:
        9.6
      • target

        public <T> T target​(java.lang.Class<T> apiType,
                            java.lang.String url)
      • target

        public <T> T target​(Target<T> target)
      • build

        public Feign build()