org.springframework.http.client

## Class InterceptingClientHttpRequestFactory

- java.lang.Object
- - org.springframework.http.client.AbstractClientHttpRequestFactoryWrapper
  - - org.springframework.http.client.InterceptingClientHttpRequestFactory

- All Implemented Interfaces:
    ClientHttpRequestFactory

      public class InterceptingClientHttpRequestFactory
      extends AbstractClientHttpRequestFactoryWrapper

  Wrapper for a `ClientHttpRequestFactory` that has support for `ClientHttpRequestInterceptor`s.
  Since:
    3.1
  Author:
    Arjen Poutsma

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `InterceptingClientHttpRequestFactory(ClientHttpRequestFactory requestFactory, List<ClientHttpRequestInterceptor> interceptors)` Creates a new instance of the `InterceptingClientHttpRequestFactory` with the given parameters.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected ClientHttpRequest` | `createRequest(URI uri, HttpMethod httpMethod, ClientHttpRequestFactory requestFactory)` Create a new `ClientHttpRequest` for the specified URI and HTTP method by using the passed-on request factory.

    - ### Methods inherited from class org.springframework.http.client.AbstractClientHttpRequestFactoryWrapper

      `createRequest`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### InterceptingClientHttpRequestFactory

          public InterceptingClientHttpRequestFactory(ClientHttpRequestFactory requestFactory,
                                              List<ClientHttpRequestInterceptor> interceptors)

      Creates a new instance of the `InterceptingClientHttpRequestFactory` with the given parameters.
      Parameters:
        `requestFactory` - the request factory to wrap
        `interceptors` - the interceptors that are to be applied. Can be `null`.

  - ### Method Detail

    - #### createRequest

          protected ClientHttpRequest createRequest(URI uri,
                                        HttpMethod httpMethod,
                                        ClientHttpRequestFactory requestFactory)

      Description copied from class: `AbstractClientHttpRequestFactoryWrapper`
      Create a new `ClientHttpRequest` for the specified URI and HTTP method by using the passed-on request factory.

      Called from `AbstractClientHttpRequestFactoryWrapper.createRequest(URI, HttpMethod)`.

      Specified by:
        `createRequest` in class `AbstractClientHttpRequestFactoryWrapper`
      Parameters:
        `uri` - the URI to create a request for
        `httpMethod` - the HTTP method to execute
        `requestFactory` - the wrapped request factory
      Returns:
        the created request