org.springframework.web.client

## Interface RequestCallback

- Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

      @FunctionalInterface
      public interface RequestCallback

  Callback interface for code that operates on a `ClientHttpRequest`. Allows manipulating the request headers, and write to the request body.

  Used internally by the `RestTemplate`, but also useful for application code. There several available factory methods:

  - `RestTemplate.acceptHeaderRequestCallback(Class)`
  - `RestTemplate.httpEntityCallback(Object)`
  - `RestTemplate.httpEntityCallback(Object, Type)`
  Since:
    3.0
  Author:
    Arjen Poutsma
  See Also:
    `RestTemplate.execute(java.lang.String, org.springframework.http.HttpMethod, org.springframework.web.client.RequestCallback, org.springframework.web.client.ResponseExtractor<T>, java.lang.Object...)`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `doWithRequest(ClientHttpRequest request)` Gets called by `RestTemplate.execute(java.lang.String, org.springframework.http.HttpMethod, org.springframework.web.client.RequestCallback, org.springframework.web.client.ResponseExtractor<T>, java.lang.Object...)` with an opened `ClientHttpRequest`.

- - ### Method Detail

    - #### doWithRequest

          void doWithRequest(ClientHttpRequest request)
                      throws IOException

      Gets called by `RestTemplate.execute(java.lang.String, org.springframework.http.HttpMethod, org.springframework.web.client.RequestCallback, org.springframework.web.client.ResponseExtractor<T>, java.lang.Object...)` with an opened `ClientHttpRequest`. Does not need to care about closing the request or about handling errors: this will all be handled by the `RestTemplate`.
      Parameters:
        `request` - the active HTTP request
      Throws:
        `IOException` - in case of I/O errors