org.springframework.web.client

## Class AsyncRestTemplate

- java.lang.Object
- - org.springframework.http.client.support.AsyncHttpAccessor
  - - org.springframework.web.client.AsyncRestTemplate

- All Implemented Interfaces:
    AsyncRestOperations

      public class AsyncRestTemplate
      extends AsyncHttpAccessor
      implements AsyncRestOperations

  Spring's central class for asynchronous client-side HTTP access. Exposes similar methods as `RestTemplate`, but returns `ListenableFuture` wrappers as opposed to concrete results.

  The `AsyncRestTemplate` exposes a synchronous `RestTemplate` via the `getRestOperations()` method, and it shares its error handler and message converters with this `RestTemplate`.

  For more information, please refer to the `RestTemplate` API documentation.

  Since:
    4.0
  Author:
    Arjen Poutsma
  See Also:
    `RestTemplate`

- - ### Field Summary

    - ### Fields inherited from class org.springframework.http.client.support.AsyncHttpAccessor

      `logger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AsyncRestTemplate()` Create a new instance of the `AsyncRestTemplate` using default settings.
    `AsyncRestTemplate(AsyncClientHttpRequestFactory asyncRequestFactory)` Create a new instance of the `AsyncRestTemplate` using the given `AsyncClientHttpRequestFactory`.
    `AsyncRestTemplate(AsyncClientHttpRequestFactory asyncRequestFactory, ClientHttpRequestFactory syncRequestFactory)` Creates a new instance of the `AsyncRestTemplate` using the given asynchronous and synchronous request factories.
    `AsyncRestTemplate(AsyncClientHttpRequestFactory requestFactory, RestTemplate restTemplate)` Create a new instance of the `AsyncRestTemplate` using the given `AsyncClientHttpRequestFactory` and synchronous `RestTemplate`.
    `AsyncRestTemplate(AsyncListenableTaskExecutor taskExecutor)` Create a new instance of the `AsyncRestTemplate` using the given `AsyncTaskExecutor`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected <T> AsyncRequestCallback` | `acceptHeaderRequestCallback(Class<T> responseType)` Returns a request callback implementation that prepares the request `Accept` headers based on the given response type and configured message converters.
    `ListenableFuture<?>` | `delete(String url, Map<String,?> urlVariables)` Asynchronously delete the resources at the specified URI.
    `ListenableFuture<?>` | `delete(String url, Object... urlVariables)` Asynchronously delete the resources at the specified URI.
    `ListenableFuture<?>` | `delete(URI url)` Asynchronously delete the resources at the specified URI.
    `protected <T> ListenableFuture<T>` | `doExecute(URI url, HttpMethod method, AsyncRequestCallback requestCallback, ResponseExtractor<T> responseExtractor)` Execute the given method on the provided URI.
    `<T> ListenableFuture<ResponseEntity<T>>` | `exchange(String url, HttpMethod method, HttpEntity<?> requestEntity, Class<T> responseType, Map<String,?> uriVariables)` Asynchronously execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response as `ResponseEntity`.
    `<T> ListenableFuture<ResponseEntity<T>>` | `exchange(String url, HttpMethod method, HttpEntity<?> requestEntity, Class<T> responseType, Object... uriVariables)` Asynchronously execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response as `ResponseEntity`.
    `<T> ListenableFuture<ResponseEntity<T>>` | `exchange(String url, HttpMethod method, HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType, Map<String,?> uriVariables)` Asynchronously execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response as `ResponseEntity`.
    `<T> ListenableFuture<ResponseEntity<T>>` | `exchange(String url, HttpMethod method, HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType, Object... uriVariables)` Asynchronously execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response as `ResponseEntity`.
    `<T> ListenableFuture<ResponseEntity<T>>` | `exchange(URI url, HttpMethod method, HttpEntity<?> requestEntity, Class<T> responseType)` Asynchronously execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response as `ResponseEntity`.
    `<T> ListenableFuture<ResponseEntity<T>>` | `exchange(URI url, HttpMethod method, HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType)` Asynchronously execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response as `ResponseEntity`.
    `<T> ListenableFuture<T>` | `execute(String url, HttpMethod method, AsyncRequestCallback requestCallback, ResponseExtractor<T> responseExtractor, Map<String,?> urlVariables)` Asynchronously execute the HTTP method to the given URI template, preparing the request with the `AsyncRequestCallback`, and reading the response with a `ResponseExtractor`.
    `<T> ListenableFuture<T>` | `execute(String url, HttpMethod method, AsyncRequestCallback requestCallback, ResponseExtractor<T> responseExtractor, Object... urlVariables)` Asynchronously execute the HTTP method to the given URI template, preparing the request with the `AsyncRequestCallback`, and reading the response with a `ResponseExtractor`.
    `<T> ListenableFuture<T>` | `execute(URI url, HttpMethod method, AsyncRequestCallback requestCallback, ResponseExtractor<T> responseExtractor)` Asynchronously execute the HTTP method to the given URL, preparing the request with the `AsyncRequestCallback`, and reading the response with a `ResponseExtractor`.
    `ResponseErrorHandler` | `getErrorHandler()` Return the error handler.
    `<T> ListenableFuture<ResponseEntity<T>>` | `getForEntity(String url, Class<T> responseType, Map<String,?> urlVariables)` Asynchronously retrieve a representation by doing a GET on the URI template.
    `<T> ListenableFuture<ResponseEntity<T>>` | `getForEntity(String url, Class<T> responseType, Object... uriVariables)` Asynchronously retrieve an entity by doing a GET on the specified URL.
    `<T> ListenableFuture<ResponseEntity<T>>` | `getForEntity(URI url, Class<T> responseType)` Asynchronously retrieve a representation by doing a GET on the URL.
    `List<HttpMessageConverter<?>>` | `getMessageConverters()` Return the message body converters.
    `RestOperations` | `getRestOperations()` Expose the synchronous Spring RestTemplate to allow synchronous invocation.
    `protected ResponseExtractor<HttpHeaders>` | `headersExtractor()` Returns a response extractor for `HttpHeaders`.
    `ListenableFuture<HttpHeaders>` | `headForHeaders(String url, Map<String,?> uriVariables)` Asynchronously retrieve all headers of the resource specified by the URI template.
    `ListenableFuture<HttpHeaders>` | `headForHeaders(String url, Object... uriVariables)` Asynchronously retrieve all headers of the resource specified by the URI template.
    `ListenableFuture<HttpHeaders>` | `headForHeaders(URI url)` Asynchronously retrieve all headers of the resource specified by the URL.
    `protected <T> AsyncRequestCallback` | `httpEntityCallback(HttpEntity<T> requestBody)` Returns a request callback implementation that writes the given object to the request stream.
    `protected <T> AsyncRequestCallback` | `httpEntityCallback(HttpEntity<T> request, Type responseType)` Returns a request callback implementation that writes the given object to the request stream.
    `ListenableFuture<Set<HttpMethod>>` | `optionsForAllow(String url, Map<String,?> uriVariables)` Asynchronously return the value of the Allow header for the given URI.
    `ListenableFuture<Set<HttpMethod>>` | `optionsForAllow(String url, Object... uriVariables)` Asynchronously return the value of the Allow header for the given URI.
    `ListenableFuture<Set<HttpMethod>>` | `optionsForAllow(URI url)` Asynchronously return the value of the Allow header for the given URL.
    `<T> ListenableFuture<ResponseEntity<T>>` | `postForEntity(String url, HttpEntity<?> request, Class<T> responseType, Map<String,?> uriVariables)` Create a new resource by POSTing the given object to the URI template, and asynchronously returns the response as `ResponseEntity`.
    `<T> ListenableFuture<ResponseEntity<T>>` | `postForEntity(String url, HttpEntity<?> request, Class<T> responseType, Object... uriVariables)` Create a new resource by POSTing the given object to the URI template, and asynchronously returns the response as `ResponseEntity`.
    `<T> ListenableFuture<ResponseEntity<T>>` | `postForEntity(URI url, HttpEntity<?> request, Class<T> responseType)` Create a new resource by POSTing the given object to the URL, and asynchronously returns the response as `ResponseEntity`.
    `ListenableFuture<URI>` | `postForLocation(String url, HttpEntity<?> request, Map<String,?> uriVariables)` Create a new resource by POSTing the given object to the URI template, and asynchronously returns the value of the `Location` header.
    `ListenableFuture<URI>` | `postForLocation(String url, HttpEntity<?> request, Object... uriVariables)` Create a new resource by POSTing the given object to the URI template, and asynchronously returns the value of the `Location` header.
    `ListenableFuture<URI>` | `postForLocation(URI url, HttpEntity<?> request)` Create a new resource by POSTing the given object to the URL, and asynchronously returns the value of the `Location` header.
    `ListenableFuture<?>` | `put(String url, HttpEntity<?> request, Map<String,?> uriVariables)` Creates a new resource by PUTting the given object to URI template.
    `ListenableFuture<?>` | `put(String url, HttpEntity<?> request, Object... uriVariables)` Create or update a resource by PUTting the given object to the URI.
    `ListenableFuture<?>` | `put(URI url, HttpEntity<?> request)` Creates a new resource by PUTting the given object to URL.
    `protected <T> ResponseExtractor<ResponseEntity<T>>` | `responseEntityExtractor(Type responseType)` Returns a response extractor for `ResponseEntity`.
    `void` | `setErrorHandler(ResponseErrorHandler errorHandler)` Set the error handler.
    `void` | `setMessageConverters(List<HttpMessageConverter<?>> messageConverters)` Set the message body converters to use.

    - ### Methods inherited from class org.springframework.http.client.support.AsyncHttpAccessor

      `createAsyncRequest, getAsyncRequestFactory, setAsyncRequestFactory`

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

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

- - ### Constructor Detail

    - #### AsyncRestTemplate

          public AsyncRestTemplate()

      Create a new instance of the `AsyncRestTemplate` using default settings.

      This constructor uses a `SimpleClientHttpRequestFactory` in combination with a `SimpleAsyncTaskExecutor` for asynchronous execution.

    - #### AsyncRestTemplate

          public AsyncRestTemplate(AsyncListenableTaskExecutor taskExecutor)

      Create a new instance of the `AsyncRestTemplate` using the given `AsyncTaskExecutor`.

      This constructor uses a `SimpleClientHttpRequestFactory` in combination with the given `AsyncTaskExecutor` for asynchronous execution.

    - #### AsyncRestTemplate

          public AsyncRestTemplate(AsyncClientHttpRequestFactory asyncRequestFactory)

      Create a new instance of the `AsyncRestTemplate` using the given `AsyncClientHttpRequestFactory`.

      This constructor will cast the given asynchronous `AsyncClientHttpRequestFactory` to a `ClientHttpRequestFactory`. Since all implementations of `ClientHttpRequestFactory` provided in Spring also implement `AsyncClientHttpRequestFactory`, this should not result in a `ClassCastException`.

    - #### AsyncRestTemplate

          public AsyncRestTemplate(AsyncClientHttpRequestFactory asyncRequestFactory,
                                   ClientHttpRequestFactory syncRequestFactory)

      Creates a new instance of the `AsyncRestTemplate` using the given asynchronous and synchronous request factories.
      Parameters:
        `asyncRequestFactory` - the asynchronous request factory
        `syncRequestFactory` - the synchronous request factory

    - #### AsyncRestTemplate

          public AsyncRestTemplate(AsyncClientHttpRequestFactory requestFactory,
                                   RestTemplate restTemplate)

      Create a new instance of the `AsyncRestTemplate` using the given `AsyncClientHttpRequestFactory` and synchronous `RestTemplate`.
      Parameters:
        `requestFactory` - the asynchronous request factory to use
        `restTemplate` - the synchronous template to use

  - ### Method Detail

    - #### setErrorHandler

          public void setErrorHandler(ResponseErrorHandler errorHandler)

      Set the error handler.

      By default, AsyncRestTemplate uses a `DefaultResponseErrorHandler`.

    - #### getErrorHandler

          public ResponseErrorHandler getErrorHandler()

      Return the error handler.

    - #### getRestOperations

          public RestOperations getRestOperations()

      Description copied from interface: `AsyncRestOperations`
      Expose the synchronous Spring RestTemplate to allow synchronous invocation.
      Specified by:
        `getRestOperations` in interface `AsyncRestOperations`

    - #### setMessageConverters

          public void setMessageConverters(List<HttpMessageConverter<?>> messageConverters)

      Set the message body converters to use.

      These converters are used to convert from and to HTTP requests and responses.

    - #### getMessageConverters

          public List<HttpMessageConverter<?>> getMessageConverters()

      Return the message body converters.

    - #### getForEntity

          public <T> ListenableFuture<ResponseEntity<T>> getForEntity(String url,
                                                                      Class<T> responseType,
                                                                      Object... uriVariables)
                                                               throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Asynchronously retrieve an entity by doing a GET on the specified URL. The response is converted and stored in an `ResponseEntity`.

      URI Template variables are expanded using the given URI variables, if any.

      Specified by:
        `getForEntity` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `responseType` - the type of the return value
        `uriVariables` - the variables to expand the template
      Returns:
        the entity wrapped in a `Future`
      Throws:
        `RestClientException`

    - #### getForEntity

          public <T> ListenableFuture<ResponseEntity<T>> getForEntity(String url,
                                                                      Class<T> responseType,
                                                                      Map<String,?> urlVariables)
                                                               throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Asynchronously retrieve a representation by doing a GET on the URI template. The response is converted and stored in an `ResponseEntity`.

      URI Template variables are expanded using the given map.

      Specified by:
        `getForEntity` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `responseType` - the type of the return value
        `urlVariables` - the map containing variables for the URI template
      Returns:
        the entity wrapped in a `Future`
      Throws:
        `RestClientException`

    - #### getForEntity

          public <T> ListenableFuture<ResponseEntity<T>> getForEntity(URI url,
                                                                      Class<T> responseType)
                                                               throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Asynchronously retrieve a representation by doing a GET on the URL. The response is converted and stored in an `ResponseEntity`.
      Specified by:
        `getForEntity` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `responseType` - the type of the return value
      Returns:
        the entity wrapped in a `Future`
      Throws:
        `RestClientException`

    - #### headForHeaders

          public ListenableFuture<HttpHeaders> headForHeaders(String url,
                                                              Object... uriVariables)
                                                       throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Asynchronously retrieve all headers of the resource specified by the URI template.

      URI Template variables are expanded using the given URI variables, if any.

      Specified by:
        `headForHeaders` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `uriVariables` - the variables to expand the template
      Returns:
        all HTTP headers of that resource wrapped in a `Future`
      Throws:
        `RestClientException`

    - #### headForHeaders

          public ListenableFuture<HttpHeaders> headForHeaders(String url,
                                                              Map<String,?> uriVariables)
                                                       throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Asynchronously retrieve all headers of the resource specified by the URI template.

      URI Template variables are expanded using the given map.

      Specified by:
        `headForHeaders` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `uriVariables` - the map containing variables for the URI template
      Returns:
        all HTTP headers of that resource wrapped in a `Future`
      Throws:
        `RestClientException`

    - #### headForHeaders

          public ListenableFuture<HttpHeaders> headForHeaders(URI url)
                                                       throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Asynchronously retrieve all headers of the resource specified by the URL.
      Specified by:
        `headForHeaders` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
      Returns:
        all HTTP headers of that resource wrapped in a `Future`
      Throws:
        `RestClientException`

    - #### postForLocation

          public ListenableFuture<URI> postForLocation(String url,
                                                       HttpEntity<?> request,
                                                       Object... uriVariables)
                                                throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Create a new resource by POSTing the given object to the URI template, and asynchronously returns the value of the `Location` header. This header typically indicates where the new resource is stored.

      URI Template variables are expanded using the given URI variables, if any.

      Specified by:
        `postForLocation` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `request` - the Object to be POSTed, may be `null`
        `uriVariables` - the variables to expand the template
      Returns:
        the value for the `Location` header wrapped in a `Future`
      Throws:
        `RestClientException`
      See Also:
        `HttpEntity`

    - #### postForLocation

          public ListenableFuture<URI> postForLocation(String url,
                                                       HttpEntity<?> request,
                                                       Map<String,?> uriVariables)
                                                throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Create a new resource by POSTing the given object to the URI template, and asynchronously returns the value of the `Location` header. This header typically indicates where the new resource is stored.

      URI Template variables are expanded using the given map.

      Specified by:
        `postForLocation` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `request` - the Object to be POSTed, may be `null`
        `uriVariables` - the variables to expand the template
      Returns:
        the value for the `Location` header wrapped in a `Future`
      Throws:
        `RestClientException`
      See Also:
        `HttpEntity`

    - #### postForLocation

          public ListenableFuture<URI> postForLocation(URI url,
                                                       HttpEntity<?> request)
                                                throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Create a new resource by POSTing the given object to the URL, and asynchronously returns the value of the `Location` header. This header typically indicates where the new resource is stored.
      Specified by:
        `postForLocation` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `request` - the Object to be POSTed, may be `null`
      Returns:
        the value for the `Location` header wrapped in a `Future`
      Throws:
        `RestClientException`
      See Also:
        `HttpEntity`

    - #### postForEntity

          public <T> ListenableFuture<ResponseEntity<T>> postForEntity(String url,
                                                                       HttpEntity<?> request,
                                                                       Class<T> responseType,
                                                                       Object... uriVariables)
                                                                throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Create a new resource by POSTing the given object to the URI template, and asynchronously returns the response as `ResponseEntity`.

      URI Template variables are expanded using the given URI variables, if any.

      Specified by:
        `postForEntity` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `request` - the Object to be POSTed, may be `null`
        `uriVariables` - the variables to expand the template
      Returns:
        the entity wrapped in a `Future`
      Throws:
        `RestClientException`
      See Also:
        `HttpEntity`

    - #### postForEntity

          public <T> ListenableFuture<ResponseEntity<T>> postForEntity(String url,
                                                                       HttpEntity<?> request,
                                                                       Class<T> responseType,
                                                                       Map<String,?> uriVariables)
                                                                throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Create a new resource by POSTing the given object to the URI template, and asynchronously returns the response as `ResponseEntity`.

      URI Template variables are expanded using the given map.

      Specified by:
        `postForEntity` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `request` - the Object to be POSTed, may be `null`
        `uriVariables` - the variables to expand the template
      Returns:
        the entity wrapped in a `Future`
      Throws:
        `RestClientException`
      See Also:
        `HttpEntity`

    - #### postForEntity

          public <T> ListenableFuture<ResponseEntity<T>> postForEntity(URI url,
                                                                       HttpEntity<?> request,
                                                                       Class<T> responseType)
                                                                throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Create a new resource by POSTing the given object to the URL, and asynchronously returns the response as `ResponseEntity`.
      Specified by:
        `postForEntity` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `request` - the Object to be POSTed, may be `null`
      Returns:
        the entity wrapped in a `Future`
      Throws:
        `RestClientException`
      See Also:
        `HttpEntity`

    - #### put

          public ListenableFuture<?> put(String url,
                                         HttpEntity<?> request,
                                         Object... uriVariables)
                                  throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Create or update a resource by PUTting the given object to the URI.

      URI Template variables are expanded using the given URI variables, if any.

      The Future will return a `null` result upon completion.

      Specified by:
        `put` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `request` - the Object to be PUT, may be `null`
        `uriVariables` - the variables to expand the template
      Throws:
        `RestClientException`
      See Also:
        `HttpEntity`

    - #### put

          public ListenableFuture<?> put(String url,
                                         HttpEntity<?> request,
                                         Map<String,?> uriVariables)
                                  throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Creates a new resource by PUTting the given object to URI template.

      URI Template variables are expanded using the given map.

      The Future will return a `null` result upon completion.

      Specified by:
        `put` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `request` - the Object to be PUT, may be `null`
        `uriVariables` - the variables to expand the template
      Throws:
        `RestClientException`
      See Also:
        `HttpEntity`

    - #### put

          public ListenableFuture<?> put(URI url,
                                         HttpEntity<?> request)
                                  throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Creates a new resource by PUTting the given object to URL.

      The Future will return a `null` result upon completion.

      Specified by:
        `put` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `request` - the Object to be PUT, may be `null`
      Throws:
        `RestClientException`
      See Also:
        `HttpEntity`

    - #### delete

          public ListenableFuture<?> delete(String url,
                                            Object... urlVariables)
                                     throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Asynchronously delete the resources at the specified URI.

      URI Template variables are expanded using the given URI variables, if any.

      The Future will return a `null` result upon completion.

      Specified by:
        `delete` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `urlVariables` - the variables to expand in the template
      Throws:
        `RestClientException`

    - #### delete

          public ListenableFuture<?> delete(String url,
                                            Map<String,?> urlVariables)
                                     throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Asynchronously delete the resources at the specified URI.

      URI Template variables are expanded using the given URI variables, if any.

      The Future will return a `null` result upon completion.

      Specified by:
        `delete` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `urlVariables` - the variables to expand in the template
      Throws:
        `RestClientException`

    - #### delete

          public ListenableFuture<?> delete(URI url)
                                     throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Asynchronously delete the resources at the specified URI.

      URI Template variables are expanded using the given URI variables, if any.

      The Future will return a `null` result upon completion.

      Specified by:
        `delete` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
      Throws:
        `RestClientException`

    - #### optionsForAllow

          public ListenableFuture<Set<HttpMethod>> optionsForAllow(String url,
                                                                   Object... uriVariables)
                                                            throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Asynchronously return the value of the Allow header for the given URI.

      URI Template variables are expanded using the given URI variables, if any.

      Specified by:
        `optionsForAllow` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `uriVariables` - the variables to expand in the template
      Returns:
        the value of the allow header wrapped in a `Future`
      Throws:
        `RestClientException`

    - #### optionsForAllow

          public ListenableFuture<Set<HttpMethod>> optionsForAllow(String url,
                                                                   Map<String,?> uriVariables)
                                                            throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Asynchronously return the value of the Allow header for the given URI.

      URI Template variables are expanded using the given map.

      Specified by:
        `optionsForAllow` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `uriVariables` - the variables to expand in the template
      Returns:
        the value of the allow header wrapped in a `Future`
      Throws:
        `RestClientException`

    - #### optionsForAllow

          public ListenableFuture<Set<HttpMethod>> optionsForAllow(URI url)
                                                            throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Asynchronously return the value of the Allow header for the given URL.
      Specified by:
        `optionsForAllow` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
      Returns:
        the value of the allow header wrapped in a `Future`
      Throws:
        `RestClientException`

    - #### exchange

          public <T> ListenableFuture<ResponseEntity<T>> exchange(String url,
                                                                  HttpMethod method,
                                                                  HttpEntity<?> requestEntity,
                                                                  Class<T> responseType,
                                                                  Object... uriVariables)
                                                           throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Asynchronously execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response as `ResponseEntity`.

      URI Template variables are expanded using the given URI variables, if any.

      Specified by:
        `exchange` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `method` - the HTTP method (GET, POST, etc)
        `requestEntity` - the entity (headers and/or body) to write to the request (may be `null`)
        `responseType` - the type of the return value
        `uriVariables` - the variables to expand in the template
      Returns:
        the response as entity wrapped in a `Future`
      Throws:
        `RestClientException`

    - #### exchange

          public <T> ListenableFuture<ResponseEntity<T>> exchange(String url,
                                                                  HttpMethod method,
                                                                  HttpEntity<?> requestEntity,
                                                                  Class<T> responseType,
                                                                  Map<String,?> uriVariables)
                                                           throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Asynchronously execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response as `ResponseEntity`.

      URI Template variables are expanded using the given URI variables, if any.

      Specified by:
        `exchange` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `method` - the HTTP method (GET, POST, etc)
        `requestEntity` - the entity (headers and/or body) to write to the request (may be `null`)
        `responseType` - the type of the return value
        `uriVariables` - the variables to expand in the template
      Returns:
        the response as entity wrapped in a `Future`
      Throws:
        `RestClientException`

    - #### exchange

          public <T> ListenableFuture<ResponseEntity<T>> exchange(URI url,
                                                                  HttpMethod method,
                                                                  HttpEntity<?> requestEntity,
                                                                  Class<T> responseType)
                                                           throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Asynchronously execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response as `ResponseEntity`.
      Specified by:
        `exchange` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `method` - the HTTP method (GET, POST, etc)
        `requestEntity` - the entity (headers and/or body) to write to the request (may be `null`)
        `responseType` - the type of the return value
      Returns:
        the response as entity wrapped in a `Future`
      Throws:
        `RestClientException`

    - #### exchange

          public <T> ListenableFuture<ResponseEntity<T>> exchange(String url,
                                                                  HttpMethod method,
                                                                  HttpEntity<?> requestEntity,
                                                                  ParameterizedTypeReference<T> responseType,
                                                                  Object... uriVariables)
                                                           throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Asynchronously execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response as `ResponseEntity`. The given `ParameterizedTypeReference` is used to pass generic type information:

           ParameterizedTypeReference<List<MyBean>> myBean = new ParameterizedTypeReference<List<MyBean>>() {};
           ResponseEntity<List<MyBean>> response = template.exchange("http://example.com",HttpMethod.GET, null, myBean);

      Specified by:
        `exchange` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `method` - the HTTP method (GET, POST, etc)
        `requestEntity` - the entity (headers and/or body) to write to the request, may be `null`
        `responseType` - the type of the return value
        `uriVariables` - the variables to expand in the template
      Returns:
        the response as entity wrapped in a `Future`
      Throws:
        `RestClientException`

    - #### exchange

          public <T> ListenableFuture<ResponseEntity<T>> exchange(String url,
                                                                  HttpMethod method,
                                                                  HttpEntity<?> requestEntity,
                                                                  ParameterizedTypeReference<T> responseType,
                                                                  Map<String,?> uriVariables)
                                                           throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Asynchronously execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response as `ResponseEntity`. The given `ParameterizedTypeReference` is used to pass generic type information:

           ParameterizedTypeReference<List<MyBean>> myBean = new ParameterizedTypeReference<List<MyBean>>() {};
           ResponseEntity<List<MyBean>> response = template.exchange("http://example.com",HttpMethod.GET, null, myBean);

      Specified by:
        `exchange` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `method` - the HTTP method (GET, POST, etc)
        `requestEntity` - the entity (headers and/or body) to write to the request, may be `null`
        `responseType` - the type of the return value
        `uriVariables` - the variables to expand in the template
      Returns:
        the response as entity wrapped in a `Future`
      Throws:
        `RestClientException`

    - #### exchange

          public <T> ListenableFuture<ResponseEntity<T>> exchange(URI url,
                                                                  HttpMethod method,
                                                                  HttpEntity<?> requestEntity,
                                                                  ParameterizedTypeReference<T> responseType)
                                                           throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Asynchronously execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response as `ResponseEntity`. The given `ParameterizedTypeReference` is used to pass generic type information:

           ParameterizedTypeReference<List<MyBean>> myBean = new ParameterizedTypeReference<List<MyBean>>() {};
           ResponseEntity<List<MyBean>> response = template.exchange("http://example.com",HttpMethod.GET, null, myBean);

      Specified by:
        `exchange` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `method` - the HTTP method (GET, POST, etc)
        `requestEntity` - the entity (headers and/or body) to write to the request, may be `null`
        `responseType` - the type of the return value
      Returns:
        the response as entity wrapped in a `Future`
      Throws:
        `RestClientException`

    - #### execute

          public <T> ListenableFuture<T> execute(String url,
                                                 HttpMethod method,
                                                 AsyncRequestCallback requestCallback,
                                                 ResponseExtractor<T> responseExtractor,
                                                 Object... urlVariables)
                                          throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Asynchronously execute the HTTP method to the given URI template, preparing the request with the `AsyncRequestCallback`, and reading the response with a `ResponseExtractor`.

      URI Template variables are expanded using the given URI variables, if any.

      Specified by:
        `execute` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `method` - the HTTP method (GET, POST, etc)
        `requestCallback` - object that prepares the request
        `responseExtractor` - object that extracts the return value from the response
        `urlVariables` - the variables to expand in the template
      Returns:
        an arbitrary object, as returned by the `ResponseExtractor`
      Throws:
        `RestClientException`

    - #### execute

          public <T> ListenableFuture<T> execute(String url,
                                                 HttpMethod method,
                                                 AsyncRequestCallback requestCallback,
                                                 ResponseExtractor<T> responseExtractor,
                                                 Map<String,?> urlVariables)
                                          throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Asynchronously execute the HTTP method to the given URI template, preparing the request with the `AsyncRequestCallback`, and reading the response with a `ResponseExtractor`.

      URI Template variables are expanded using the given URI variables map.

      Specified by:
        `execute` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `method` - the HTTP method (GET, POST, etc)
        `requestCallback` - object that prepares the request
        `responseExtractor` - object that extracts the return value from the response
        `urlVariables` - the variables to expand in the template
      Returns:
        an arbitrary object, as returned by the `ResponseExtractor`
      Throws:
        `RestClientException`

    - #### execute

          public <T> ListenableFuture<T> execute(URI url,
                                                 HttpMethod method,
                                                 AsyncRequestCallback requestCallback,
                                                 ResponseExtractor<T> responseExtractor)
                                          throws RestClientException

      Description copied from interface: `AsyncRestOperations`
      Asynchronously execute the HTTP method to the given URL, preparing the request with the `AsyncRequestCallback`, and reading the response with a `ResponseExtractor`.
      Specified by:
        `execute` in interface `AsyncRestOperations`
      Parameters:
        `url` - the URL
        `method` - the HTTP method (GET, POST, etc)
        `requestCallback` - object that prepares the request
        `responseExtractor` - object that extracts the return value from the response
      Returns:
        an arbitrary object, as returned by the `ResponseExtractor`
      Throws:
        `RestClientException`

    - #### doExecute

          protected <T> ListenableFuture<T> doExecute(URI url,
                                                      HttpMethod method,
                                                      AsyncRequestCallback requestCallback,
                                                      ResponseExtractor<T> responseExtractor)
                                               throws RestClientException

      Execute the given method on the provided URI. The `ClientHttpRequest` is processed using the `RequestCallback`; the response with the `ResponseExtractor`.
      Parameters:
        `url` - the fully-expanded URL to connect to
        `method` - the HTTP method to execute (GET, POST, etc.)
        `requestCallback` - object that prepares the request (can be `null`)
        `responseExtractor` - object that extracts the return value from the response (can be `null`)
      Returns:
        an arbitrary object, as returned by the `ResponseExtractor`
      Throws:
        `RestClientException`

    - #### acceptHeaderRequestCallback

          protected <T> AsyncRequestCallback acceptHeaderRequestCallback(Class<T> responseType)

      Returns a request callback implementation that prepares the request `Accept` headers based on the given response type and configured message converters.

    - #### httpEntityCallback

          protected <T> AsyncRequestCallback httpEntityCallback(HttpEntity<T> requestBody)

      Returns a request callback implementation that writes the given object to the request stream.

    - #### httpEntityCallback

          protected <T> AsyncRequestCallback httpEntityCallback(HttpEntity<T> request,
                                                                Type responseType)

      Returns a request callback implementation that writes the given object to the request stream.

    - #### responseEntityExtractor

          protected <T> ResponseExtractor<ResponseEntity<T>> responseEntityExtractor(Type responseType)

      Returns a response extractor for `ResponseEntity`.

    - #### headersExtractor

          protected ResponseExtractor<HttpHeaders> headersExtractor()

      Returns a response extractor for `HttpHeaders`.