org.apache.hc.client5.http.classic

## Interface ExecChainHandler

- All Known Implementing Classes:
    BackoffStrategyExec, ConnectExec, ContentCompressionExec, HttpRequestRetryExec, MainClientExec, ProtocolExec, RedirectExec

      @Contract(threading=STATELESS)
      public interface ExecChainHandler

  Abstract request execution handler in a classic client side request execution chain. Handlers can either be a decorator around another element that implements a cross cutting aspect or a self-contained executor capable of producing a response for the given request.

  Important: please note it is required for decorators that implement post execution aspects or response post-processing of any sort to release resources associated with the response by calling `Closeable.close()` methods in case of an I/O, protocol or runtime exception, or in case the response is not propagated to the caller.

  For information regarding the handler chain behaviour in case of a request re-execution, please refer to the `HttpRequestRetryExec` javadoc.

  Well known request execution handlers could be referred to by name using one of the `ChainElement` enum values.

  Since:
    4.3
  See Also:
    `ChainElement`, `HttpClientBuilder.addExecInterceptorFirst(String, ExecChainHandler)`, `HttpClientBuilder.addExecInterceptorBefore(String, String, ExecChainHandler)`, `HttpClientBuilder.addExecInterceptorAfter(String, String, ExecChainHandler)`, `HttpClientBuilder.addExecInterceptorLast(String, ExecChainHandler)`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `ClassicHttpResponse` | `execute(ClassicHttpRequest request, ExecChain.Scope scope, ExecChain chain)` Executes the actual HTTP request.

- - ### Method Detail

    - #### execute

          ClassicHttpResponse execute(ClassicHttpRequest request,
                                      ExecChain.Scope scope,
                                      ExecChain chain)
                               throws IOException,
                                      HttpException

      Executes the actual HTTP request. The handler can choose to return a response message or delegate request execution to the next element in the execution chain.
      Parameters:
        `request` - the actual request.
        `scope` - the execution scope .
        `chain` - the next element in the request execution chain.
      Throws:
        `IOException`
        `HttpException`

Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.