Class AsyncRestTemplate
- java.lang.Object
- org.springframework.http.client.support.AsyncHttpAccessor
- org.springframework.http.client.support.InterceptingAsyncHttpAccessor
- org.springframework.web.client.AsyncRestTemplate
- All Implemented Interfaces:
AsyncRestOperations
@Deprecated public class AsyncRestTemplate extends InterceptingAsyncHttpAccessor implements AsyncRestOperations
Deprecated.as of Spring 5.0, in favor ofWebClient
Spring's central class for asynchronous client-side HTTP access. Exposes similar methods asRestTemplate
, but returnsListenableFuture
wrappers as opposed to concrete results.The
AsyncRestTemplate
exposes a synchronousRestTemplate
via thegetRestOperations()
method and shares its error handler and message converters with thatRestTemplate
.Note: by default
AsyncRestTemplate
relies on standard JDK facilities to establish HTTP connections. You can switch to use a different HTTP library such as Apache HttpComponents, Netty, and OkHttp by using a constructor accepting anAsyncClientHttpRequestFactory
.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 Description AsyncRestTemplate()
Deprecated.Create a new instance of theAsyncRestTemplate
using default settings.AsyncRestTemplate(AsyncListenableTaskExecutor taskExecutor)
Deprecated.Create a new instance of theAsyncRestTemplate
using the givenAsyncTaskExecutor
.AsyncRestTemplate(AsyncClientHttpRequestFactory asyncRequestFactory)
Deprecated.Create a new instance of theAsyncRestTemplate
using the givenAsyncClientHttpRequestFactory
.AsyncRestTemplate(AsyncClientHttpRequestFactory asyncRequestFactory, ClientHttpRequestFactory syncRequestFactory)
Deprecated.Creates a new instance of theAsyncRestTemplate
using the given asynchronous and synchronous request factories.AsyncRestTemplate(AsyncClientHttpRequestFactory requestFactory, RestTemplate restTemplate)
Deprecated.Create a new instance of theAsyncRestTemplate
using the givenAsyncClientHttpRequestFactory
and synchronousRestTemplate
.
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected <T> AsyncRequestCallback
acceptHeaderRequestCallback(Class<T> responseType)
Deprecated.Returns a request callback implementation that prepares the requestAccept
headers based on the given response type and configured message converters.ListenableFuture<?>
delete(String url, Object... uriVariables)
Deprecated.Asynchronously delete the resources at the specified URI.ListenableFuture<?>
delete(String url, Map<String,?> uriVariables)
Deprecated.Asynchronously delete the resources at the specified URI.ListenableFuture<?>
delete(URI url)
Deprecated.Asynchronously delete the resources at the specified URI.protected <T> ListenableFuture<T>
doExecute(URI url, HttpMethod method, AsyncRequestCallback requestCallback, ResponseExtractor<T> responseExtractor)
Deprecated.Execute the given method on the provided URI.<T> ListenableFuture<ResponseEntity<T>>
exchange(String url, HttpMethod method, HttpEntity<?> requestEntity, Class<T> responseType, Object... uriVariables)
Deprecated.Asynchronously execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response asResponseEntity
.<T> ListenableFuture<ResponseEntity<T>>
exchange(String url, HttpMethod method, HttpEntity<?> requestEntity, Class<T> responseType, Map<String,?> uriVariables)
Deprecated.Asynchronously execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response asResponseEntity
.<T> ListenableFuture<ResponseEntity<T>>
exchange(String url, HttpMethod method, HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType, Object... uriVariables)
Deprecated.Asynchronously execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response asResponseEntity
.<T> ListenableFuture<ResponseEntity<T>>
exchange(String url, HttpMethod method, HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType, Map<String,?> uriVariables)
Deprecated.Asynchronously execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response asResponseEntity
.<T> ListenableFuture<ResponseEntity<T>>
exchange(URI url, HttpMethod method, HttpEntity<?> requestEntity, Class<T> responseType)
Deprecated.Asynchronously execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response asResponseEntity
.<T> ListenableFuture<ResponseEntity<T>>
exchange(URI url, HttpMethod method, HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType)
Deprecated.Asynchronously execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response asResponseEntity
.<T> ListenableFuture<T>
execute(String url, HttpMethod method, AsyncRequestCallback requestCallback, ResponseExtractor<T> responseExtractor, Object... uriVariables)
Deprecated.Asynchronously execute the HTTP method to the given URI template, preparing the request with theAsyncRequestCallback
, and reading the response with aResponseExtractor
.<T> ListenableFuture<T>
execute(String url, HttpMethod method, AsyncRequestCallback requestCallback, ResponseExtractor<T> responseExtractor, Map<String,?> uriVariables)
Deprecated.Asynchronously execute the HTTP method to the given URI template, preparing the request with theAsyncRequestCallback
, and reading the response with aResponseExtractor
.<T> ListenableFuture<T>
execute(URI url, HttpMethod method, AsyncRequestCallback requestCallback, ResponseExtractor<T> responseExtractor)
Deprecated.Asynchronously execute the HTTP method to the given URL, preparing the request with theAsyncRequestCallback
, and reading the response with aResponseExtractor
.ResponseErrorHandler
getErrorHandler()
Deprecated.Return the error handler.<T> ListenableFuture<ResponseEntity<T>>
getForEntity(String url, Class<T> responseType, Object... uriVariables)
Deprecated.Asynchronously retrieve an entity by doing a GET on the specified URL.<T> ListenableFuture<ResponseEntity<T>>
getForEntity(String url, Class<T> responseType, Map<String,?> uriVariables)
Deprecated.Asynchronously retrieve a representation by doing a GET on the URI template.<T> ListenableFuture<ResponseEntity<T>>
getForEntity(URI url, Class<T> responseType)
Deprecated.Asynchronously retrieve a representation by doing a GET on the URL.List<HttpMessageConverter<?>>
getMessageConverters()
Deprecated.Return the message body converters.RestOperations
getRestOperations()
Deprecated.Expose the synchronous Spring RestTemplate to allow synchronous invocation.UriTemplateHandler
getUriTemplateHandler()
Deprecated.Return the configured URI template handler.protected ResponseExtractor<HttpHeaders>
headersExtractor()
Deprecated.Returns a response extractor forHttpHeaders
.ListenableFuture<HttpHeaders>
headForHeaders(String url, Object... uriVariables)
Deprecated.Asynchronously retrieve all headers of the resource specified by the URI template.ListenableFuture<HttpHeaders>
headForHeaders(String url, Map<String,?> uriVariables)
Deprecated.Asynchronously retrieve all headers of the resource specified by the URI template.ListenableFuture<HttpHeaders>
headForHeaders(URI url)
Deprecated.Asynchronously retrieve all headers of the resource specified by the URL.protected <T> AsyncRequestCallback
httpEntityCallback(HttpEntity<T> requestBody)
Deprecated.Returns a request callback implementation that writes the given object to the request stream.protected <T> AsyncRequestCallback
httpEntityCallback(HttpEntity<T> request, Type responseType)
Deprecated.Returns a request callback implementation that writes the given object to the request stream.ListenableFuture<Set<HttpMethod>>
optionsForAllow(String url, Object... uriVars)
Deprecated.Asynchronously return the value of the Allow header for the given URI.ListenableFuture<Set<HttpMethod>>
optionsForAllow(String url, Map<String,?> uriVars)
Deprecated.Asynchronously return the value of the Allow header for the given URI.ListenableFuture<Set<HttpMethod>>
optionsForAllow(URI url)
Deprecated.Asynchronously return the value of the Allow header for the given URL.<T> ListenableFuture<ResponseEntity<T>>
postForEntity(String url, HttpEntity<?> request, Class<T> responseType, Object... uriVariables)
Deprecated.Create a new resource by POSTing the given object to the URI template, and asynchronously returns the response asResponseEntity
.<T> ListenableFuture<ResponseEntity<T>>
postForEntity(String url, HttpEntity<?> request, Class<T> responseType, Map<String,?> uriVariables)
Deprecated.Create a new resource by POSTing the given object to the URI template, and asynchronously returns the response asResponseEntity
.<T> ListenableFuture<ResponseEntity<T>>
postForEntity(URI url, HttpEntity<?> request, Class<T> responseType)
Deprecated.Create a new resource by POSTing the given object to the URL, and asynchronously returns the response asResponseEntity
.ListenableFuture<URI>
postForLocation(String url, HttpEntity<?> request, Object... uriVars)
Deprecated.Create a new resource by POSTing the given object to the URI template, and asynchronously returns the value of theLocation
header.ListenableFuture<URI>
postForLocation(String url, HttpEntity<?> request, Map<String,?> uriVars)
Deprecated.Create a new resource by POSTing the given object to the URI template, and asynchronously returns the value of theLocation
header.ListenableFuture<URI>
postForLocation(URI url, HttpEntity<?> request)
Deprecated.Create a new resource by POSTing the given object to the URL, and asynchronously returns the value of theLocation
header.ListenableFuture<?>
put(String url, HttpEntity<?> request, Object... uriVars)
Deprecated.Create or update a resource by PUTting the given object to the URI.ListenableFuture<?>
put(String url, HttpEntity<?> request, Map<String,?> uriVars)
Deprecated.Creates a new resource by PUTting the given object to URI template.ListenableFuture<?>
put(URI url, HttpEntity<?> request)
Deprecated.Creates a new resource by PUTting the given object to URL.protected <T> ResponseExtractor<ResponseEntity<T>>
responseEntityExtractor(Type responseType)
Deprecated.Returns a response extractor forResponseEntity
.void
setDefaultUriVariables(Map<String,?> defaultUriVariables)
Deprecated.Configure default URI variable values.void
setErrorHandler(ResponseErrorHandler errorHandler)
Deprecated.Set the error handler.void
setMessageConverters(List<HttpMessageConverter<?>> messageConverters)
Deprecated.Set the message body converters to use.void
setUriTemplateHandler(UriTemplateHandler handler)
Deprecated.This property has the same purpose as the corresponding property on theRestTemplate
.Methods inherited from class org.springframework.http.client.support.InterceptingAsyncHttpAccessor
getAsyncRequestFactory, getInterceptors, setInterceptors
Methods inherited from class org.springframework.http.client.support.AsyncHttpAccessor
createAsyncRequest, setAsyncRequestFactory
Constructor Detail
AsyncRestTemplate
public AsyncRestTemplate()
Deprecated.Create a new instance of theAsyncRestTemplate
using default settings.This constructor uses a
SimpleClientHttpRequestFactory
in combination with aSimpleAsyncTaskExecutor
for asynchronous execution.
AsyncRestTemplate
public AsyncRestTemplate(AsyncListenableTaskExecutor taskExecutor)
Deprecated.Create a new instance of theAsyncRestTemplate
using the givenAsyncTaskExecutor
.This constructor uses a
SimpleClientHttpRequestFactory
in combination with the givenAsyncTaskExecutor
for asynchronous execution.
AsyncRestTemplate
public AsyncRestTemplate(AsyncClientHttpRequestFactory asyncRequestFactory)
Deprecated.Create a new instance of theAsyncRestTemplate
using the givenAsyncClientHttpRequestFactory
.This constructor will cast the given asynchronous
AsyncClientHttpRequestFactory
to aClientHttpRequestFactory
. Since all implementations ofClientHttpRequestFactory
provided in Spring also implementAsyncClientHttpRequestFactory
, this should not result in aClassCastException
.
AsyncRestTemplate
public AsyncRestTemplate(AsyncClientHttpRequestFactory asyncRequestFactory, ClientHttpRequestFactory syncRequestFactory)
Deprecated.Creates a new instance of theAsyncRestTemplate
using the given asynchronous and synchronous request factories.- Parameters:
asyncRequestFactory
- the asynchronous request factorysyncRequestFactory
- the synchronous request factory
AsyncRestTemplate
public AsyncRestTemplate(AsyncClientHttpRequestFactory requestFactory, RestTemplate restTemplate)
Deprecated.Create a new instance of theAsyncRestTemplate
using the givenAsyncClientHttpRequestFactory
and synchronousRestTemplate
.- Parameters:
requestFactory
- the asynchronous request factory to userestTemplate
- the synchronous template to use
Method Detail
setErrorHandler
public void setErrorHandler(ResponseErrorHandler errorHandler)
Deprecated.Set the error handler.By default, AsyncRestTemplate uses a
DefaultResponseErrorHandler
.
getErrorHandler
public ResponseErrorHandler getErrorHandler()
Deprecated.Return the error handler.
setDefaultUriVariables
public void setDefaultUriVariables(Map<String,?> defaultUriVariables)
Deprecated.Configure default URI variable values. This is a shortcut for:DefaultUriTemplateHandler handler = new DefaultUriTemplateHandler(); handler.setDefaultUriVariables(...); AsyncRestTemplate restTemplate = new AsyncRestTemplate(); restTemplate.setUriTemplateHandler(handler);
- Parameters:
defaultUriVariables
- the default URI variable values- Since:
- 4.3
setUriTemplateHandler
public void setUriTemplateHandler(UriTemplateHandler handler)
Deprecated.This property has the same purpose as the corresponding property on theRestTemplate
. For more details seeRestTemplate.setUriTemplateHandler(org.springframework.web.util.UriTemplateHandler)
.- Parameters:
handler
- the URI template handler to use
getUriTemplateHandler
public UriTemplateHandler getUriTemplateHandler()
Deprecated.Return the configured URI template handler.
getRestOperations
public RestOperations getRestOperations()
Deprecated.Description copied from interface:AsyncRestOperations
Expose the synchronous Spring RestTemplate to allow synchronous invocation.- Specified by:
getRestOperations
in interfaceAsyncRestOperations
setMessageConverters
public void setMessageConverters(List<HttpMessageConverter<?>> messageConverters)
Deprecated.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()
Deprecated.Return the message body converters.
getForEntity
public <T> ListenableFuture<ResponseEntity<T>> getForEntity(String url, Class<T> responseType, Object... uriVariables) throws RestClientException
Deprecated.Description copied from interface:AsyncRestOperations
Asynchronously retrieve an entity by doing a GET on the specified URL. The response is converted and stored in anResponseEntity
.URI Template variables are expanded using the given URI variables, if any.
- Specified by:
getForEntity
in interfaceAsyncRestOperations
- Parameters:
url
- the URLresponseType
- the type of the return valueuriVariables
- 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,?> uriVariables) throws RestClientException
Deprecated.Description copied from interface:AsyncRestOperations
Asynchronously retrieve a representation by doing a GET on the URI template. The response is converted and stored in anResponseEntity
.URI Template variables are expanded using the given map.
- Specified by:
getForEntity
in interfaceAsyncRestOperations
- Parameters:
url
- the URLresponseType
- the type of the return valueuriVariables
- 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
Deprecated.Description copied from interface:AsyncRestOperations
Asynchronously retrieve a representation by doing a GET on the URL. The response is converted and stored in anResponseEntity
.- Specified by:
getForEntity
in interfaceAsyncRestOperations
- Parameters:
url
- the URLresponseType
- 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
Deprecated.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 interfaceAsyncRestOperations
- Parameters:
url
- the URLuriVariables
- 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
Deprecated.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 interfaceAsyncRestOperations
- Parameters:
url
- the URLuriVariables
- 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
Deprecated.Description copied from interface:AsyncRestOperations
Asynchronously retrieve all headers of the resource specified by the URL.- Specified by:
headForHeaders
in interfaceAsyncRestOperations
- Parameters:
url
- the URL- Returns:
- all HTTP headers of that resource wrapped in a
Future
- Throws:
RestClientException
postForLocation
public ListenableFuture<URI> postForLocation(String url, @Nullable HttpEntity<?> request, Object... uriVars) throws RestClientException
Deprecated.Description copied from interface:AsyncRestOperations
Create a new resource by POSTing the given object to the URI template, and asynchronously returns the value of theLocation
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 interfaceAsyncRestOperations
- Parameters:
url
- the URLrequest
- the Object to be POSTed (may benull
)uriVars
- the variables to expand the template- Returns:
- the value for the
Location
header wrapped in aFuture
- Throws:
RestClientException
- See Also:
HttpEntity
postForLocation
public ListenableFuture<URI> postForLocation(String url, @Nullable HttpEntity<?> request, Map<String,?> uriVars) throws RestClientException
Deprecated.Description copied from interface:AsyncRestOperations
Create a new resource by POSTing the given object to the URI template, and asynchronously returns the value of theLocation
header. This header typically indicates where the new resource is stored.URI Template variables are expanded using the given map.
- Specified by:
postForLocation
in interfaceAsyncRestOperations
- Parameters:
url
- the URLrequest
- the Object to be POSTed (may benull
)uriVars
- the variables to expand the template- Returns:
- the value for the
Location
header wrapped in aFuture
- Throws:
RestClientException
- See Also:
HttpEntity
postForLocation
public ListenableFuture<URI> postForLocation(URI url, @Nullable HttpEntity<?> request) throws RestClientException
Deprecated.Description copied from interface:AsyncRestOperations
Create a new resource by POSTing the given object to the URL, and asynchronously returns the value of theLocation
header. This header typically indicates where the new resource is stored.- Specified by:
postForLocation
in interfaceAsyncRestOperations
- Parameters:
url
- the URLrequest
- the Object to be POSTed (may benull
)- Returns:
- the value for the
Location
header wrapped in aFuture
- Throws:
RestClientException
- See Also:
HttpEntity
postForEntity
public <T> ListenableFuture<ResponseEntity<T>> postForEntity(String url, @Nullable HttpEntity<?> request, Class<T> responseType, Object... uriVariables) throws RestClientException
Deprecated.Description copied from interface:AsyncRestOperations
Create a new resource by POSTing the given object to the URI template, and asynchronously returns the response asResponseEntity
.URI Template variables are expanded using the given URI variables, if any.
- Specified by:
postForEntity
in interfaceAsyncRestOperations
- Parameters:
url
- the URLrequest
- the Object to be POSTed (may benull
)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, @Nullable HttpEntity<?> request, Class<T> responseType, Map<String,?> uriVariables) throws RestClientException
Deprecated.Description copied from interface:AsyncRestOperations
Create a new resource by POSTing the given object to the URI template, and asynchronously returns the response asResponseEntity
.URI Template variables are expanded using the given map.
- Specified by:
postForEntity
in interfaceAsyncRestOperations
- Parameters:
url
- the URLrequest
- the Object to be POSTed (may benull
)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, @Nullable HttpEntity<?> request, Class<T> responseType) throws RestClientException
Deprecated.Description copied from interface:AsyncRestOperations
Create a new resource by POSTing the given object to the URL, and asynchronously returns the response asResponseEntity
.- Specified by:
postForEntity
in interfaceAsyncRestOperations
- Parameters:
url
- the URLrequest
- the Object to be POSTed (may benull
)- Returns:
- the entity wrapped in a
Future
- Throws:
RestClientException
- See Also:
HttpEntity
put
public ListenableFuture<?> put(String url, @Nullable HttpEntity<?> request, Object... uriVars) throws RestClientException
Deprecated.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 interfaceAsyncRestOperations
- Parameters:
url
- the URLrequest
- the Object to be PUT (may benull
)uriVars
- the variables to expand the template- Throws:
RestClientException
- See Also:
HttpEntity
put
public ListenableFuture<?> put(String url, @Nullable HttpEntity<?> request, Map<String,?> uriVars) throws RestClientException
Deprecated.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 interfaceAsyncRestOperations
- Parameters:
url
- the URLrequest
- the Object to be PUT (may benull
)uriVars
- the variables to expand the template- Throws:
RestClientException
- See Also:
HttpEntity
put
public ListenableFuture<?> put(URI url, @Nullable HttpEntity<?> request) throws RestClientException
Deprecated.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 interfaceAsyncRestOperations
- Parameters:
url
- the URLrequest
- the Object to be PUT (may benull
)- Throws:
RestClientException
- See Also:
HttpEntity
delete
public ListenableFuture<?> delete(String url, Object... uriVariables) throws RestClientException
Deprecated.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 interfaceAsyncRestOperations
- Parameters:
url
- the URLuriVariables
- the variables to expand in the template- Throws:
RestClientException
delete
public ListenableFuture<?> delete(String url, Map<String,?> uriVariables) throws RestClientException
Deprecated.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 interfaceAsyncRestOperations
- Parameters:
url
- the URLuriVariables
- the variables to expand in the template- Throws:
RestClientException
delete
public ListenableFuture<?> delete(URI url) throws RestClientException
Deprecated.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 interfaceAsyncRestOperations
- Parameters:
url
- the URL- Throws:
RestClientException
optionsForAllow
public ListenableFuture<Set<HttpMethod>> optionsForAllow(String url, Object... uriVars) throws RestClientException
Deprecated.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 interfaceAsyncRestOperations
- Parameters:
url
- the URLuriVars
- 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,?> uriVars) throws RestClientException
Deprecated.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 interfaceAsyncRestOperations
- Parameters:
url
- the URLuriVars
- 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
Deprecated.Description copied from interface:AsyncRestOperations
Asynchronously return the value of the Allow header for the given URL.- Specified by:
optionsForAllow
in interfaceAsyncRestOperations
- 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, @Nullable HttpEntity<?> requestEntity, Class<T> responseType, Object... uriVariables) throws RestClientException
Deprecated.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 asResponseEntity
.URI Template variables are expanded using the given URI variables, if any.
- Specified by:
exchange
in interfaceAsyncRestOperations
- Parameters:
url
- the URLmethod
- the HTTP method (GET, POST, etc)requestEntity
- the entity (headers and/or body) to write to the request (may benull
)responseType
- the type of the return valueuriVariables
- 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, @Nullable HttpEntity<?> requestEntity, Class<T> responseType, Map<String,?> uriVariables) throws RestClientException
Deprecated.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 asResponseEntity
.URI Template variables are expanded using the given URI variables, if any.
- Specified by:
exchange
in interfaceAsyncRestOperations
- Parameters:
url
- the URLmethod
- the HTTP method (GET, POST, etc)requestEntity
- the entity (headers and/or body) to write to the request (may benull
)responseType
- the type of the return valueuriVariables
- 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, @Nullable HttpEntity<?> requestEntity, Class<T> responseType) throws RestClientException
Deprecated.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 asResponseEntity
.- Specified by:
exchange
in interfaceAsyncRestOperations
- Parameters:
url
- the URLmethod
- the HTTP method (GET, POST, etc)requestEntity
- the entity (headers and/or body) to write to the request (may benull
)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, @Nullable HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType, Object... uriVariables) throws RestClientException
Deprecated.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 asResponseEntity
. The givenParameterizedTypeReference
is used to pass generic type information:ParameterizedTypeReference<List<MyBean>> myBean = new ParameterizedTypeReference<List<MyBean>>() {}; ResponseEntity<List<MyBean>> response = template.exchange("https://example.com",HttpMethod.GET, null, myBean);
- Specified by:
exchange
in interfaceAsyncRestOperations
- Parameters:
url
- the URLmethod
- the HTTP method (GET, POST, etc)requestEntity
- the entity (headers and/or body) to write to the request (may benull
)responseType
- the type of the return valueuriVariables
- 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, @Nullable HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType, Map<String,?> uriVariables) throws RestClientException
Deprecated.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 asResponseEntity
. The givenParameterizedTypeReference
is used to pass generic type information:ParameterizedTypeReference<List<MyBean>> myBean = new ParameterizedTypeReference<List<MyBean>>() {}; ResponseEntity<List<MyBean>> response = template.exchange("https://example.com",HttpMethod.GET, null, myBean);
- Specified by:
exchange
in interfaceAsyncRestOperations
- Parameters:
url
- the URLmethod
- the HTTP method (GET, POST, etc)requestEntity
- the entity (headers and/or body) to write to the request (may benull
)responseType
- the type of the return valueuriVariables
- 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, @Nullable HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType) throws RestClientException
Deprecated.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 asResponseEntity
. The givenParameterizedTypeReference
is used to pass generic type information:ParameterizedTypeReference<List<MyBean>> myBean = new ParameterizedTypeReference<List<MyBean>>() {}; ResponseEntity<List<MyBean>> response = template.exchange("https://example.com",HttpMethod.GET, null, myBean);
- Specified by:
exchange
in interfaceAsyncRestOperations
- Parameters:
url
- the URLmethod
- the HTTP method (GET, POST, etc)requestEntity
- the entity (headers and/or body) to write to the request (may benull
)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, @Nullable AsyncRequestCallback requestCallback, @Nullable ResponseExtractor<T> responseExtractor, Object... uriVariables) throws RestClientException
Deprecated.Description copied from interface:AsyncRestOperations
Asynchronously execute the HTTP method to the given URI template, preparing the request with theAsyncRequestCallback
, and reading the response with aResponseExtractor
.URI Template variables are expanded using the given URI variables, if any.
- Specified by:
execute
in interfaceAsyncRestOperations
- Parameters:
url
- the URLmethod
- the HTTP method (GET, POST, etc)requestCallback
- object that prepares the requestresponseExtractor
- object that extracts the return value from the responseuriVariables
- 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, @Nullable AsyncRequestCallback requestCallback, @Nullable ResponseExtractor<T> responseExtractor, Map<String,?> uriVariables) throws RestClientException
Deprecated.Description copied from interface:AsyncRestOperations
Asynchronously execute the HTTP method to the given URI template, preparing the request with theAsyncRequestCallback
, and reading the response with aResponseExtractor
.URI Template variables are expanded using the given URI variables map.
- Specified by:
execute
in interfaceAsyncRestOperations
- Parameters:
url
- the URLmethod
- the HTTP method (GET, POST, etc)requestCallback
- object that prepares the requestresponseExtractor
- object that extracts the return value from the responseuriVariables
- 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, @Nullable AsyncRequestCallback requestCallback, @Nullable ResponseExtractor<T> responseExtractor) throws RestClientException
Deprecated.Description copied from interface:AsyncRestOperations
Asynchronously execute the HTTP method to the given URL, preparing the request with theAsyncRequestCallback
, and reading the response with aResponseExtractor
.- Specified by:
execute
in interfaceAsyncRestOperations
- Parameters:
url
- the URLmethod
- the HTTP method (GET, POST, etc)requestCallback
- object that prepares the requestresponseExtractor
- 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, @Nullable AsyncRequestCallback requestCallback, @Nullable ResponseExtractor<T> responseExtractor) throws RestClientException
Deprecated.Execute the given method on the provided URI. TheClientHttpRequest
is processed using theRequestCallback
; the response with theResponseExtractor
.- Parameters:
url
- the fully-expanded URL to connect tomethod
- the HTTP method to execute (GET, POST, etc.)requestCallback
- object that prepares the request (can benull
)responseExtractor
- object that extracts the return value from the response (can benull
)- Returns:
- an arbitrary object, as returned by the
ResponseExtractor
- Throws:
RestClientException
acceptHeaderRequestCallback
protected <T> AsyncRequestCallback acceptHeaderRequestCallback(Class<T> responseType)
Deprecated.Returns a request callback implementation that prepares the requestAccept
headers based on the given response type and configured message converters.
httpEntityCallback
protected <T> AsyncRequestCallback httpEntityCallback(@Nullable HttpEntity<T> requestBody)
Deprecated.Returns a request callback implementation that writes the given object to the request stream.
httpEntityCallback
protected <T> AsyncRequestCallback httpEntityCallback(@Nullable HttpEntity<T> request, Type responseType)
Deprecated.Returns a request callback implementation that writes the given object to the request stream.
responseEntityExtractor
protected <T> ResponseExtractor<ResponseEntity<T>> responseEntityExtractor(Type responseType)
Deprecated.Returns a response extractor forResponseEntity
.
headersExtractor
protected ResponseExtractor<HttpHeaders> headersExtractor()
Deprecated.Returns a response extractor forHttpHeaders
.