接口 AsyncRestOperations
- 所有已知实现类:
AsyncRestTemplate
@Deprecated public interface AsyncRestOperations
已过时。as of Spring 5.0, in favor ofWebClient
Interface specifying a basic set of asynchronous RESTful operations. Implemented byAsyncRestTemplate
. Not often used directly, but a useful option to enhance testability, as it can easily be mocked or stubbed.- 从以下版本开始:
- 4.0
- 作者:
- Arjen Poutsma
- 另请参阅:
AsyncRestTemplate
,RestOperations
方法概要
所有方法 实例方法 抽象方法 已过时的方法 修饰符和类型 方法 说明 ListenableFuture<?>
delete(String url, Object... uriVariables)
已过时。Asynchronously delete the resources at the specified URI.ListenableFuture<?>
delete(String url, Map<String,?> uriVariables)
已过时。Asynchronously delete the resources at the specified URI.ListenableFuture<?>
delete(URI url)
已过时。Asynchronously delete the resources at the specified URI.<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 asResponseEntity
.<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 asResponseEntity
.<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 asResponseEntity
.<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 asResponseEntity
.<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 asResponseEntity
.<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 asResponseEntity
.<T> ListenableFuture<T>
execute(String url, HttpMethod method, AsyncRequestCallback requestCallback, ResponseExtractor<T> responseExtractor, Object... uriVariables)
已过时。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)
已过时。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)
已过时。Asynchronously execute the HTTP method to the given URL, preparing the request with theAsyncRequestCallback
, and reading the response with aResponseExtractor
.<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(String url, Class<T> responseType, Map<String,?> uriVariables)
已过时。Asynchronously retrieve a representation by doing a GET on the URI template.<T> ListenableFuture<ResponseEntity<T>>
getForEntity(URI url, Class<T> responseType)
已过时。Asynchronously retrieve a representation by doing a GET on the URL.RestOperations
getRestOperations()
已过时。Expose the synchronous Spring RestTemplate to allow synchronous invocation.ListenableFuture<HttpHeaders>
headForHeaders(String url, Object... uriVariables)
已过时。Asynchronously retrieve all headers of the resource specified by the URI template.ListenableFuture<HttpHeaders>
headForHeaders(String url, Map<String,?> 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.ListenableFuture<Set<HttpMethod>>
optionsForAllow(String url, Object... uriVariables)
已过时。Asynchronously return the value of the Allow header for the given URI.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(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, Object... uriVariables)
已过时。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)
已过时。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)
已过时。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... uriVariables)
已过时。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,?> uriVariables)
已过时。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)
已过时。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... uriVariables)
已过时。Create or update a resource by PUTting the given object to the URI.ListenableFuture<?>
put(String url, HttpEntity<?> request, Map<String,?> uriVariables)
已过时。Creates a new resource by PUTting the given object to URI template.ListenableFuture<?>
put(URI url, HttpEntity<?> request)
已过时。Creates a new resource by PUTting the given object to URL.
方法详细资料
getRestOperations
RestOperations getRestOperations()
已过时。Expose the synchronous Spring RestTemplate to allow synchronous invocation.
getForEntity
<T> ListenableFuture<ResponseEntity<T>> getForEntity(String url, Class<T> responseType, Object... uriVariables) throws RestClientException
已过时。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.
- 参数:
url
- the URLresponseType
- the type of the return valueuriVariables
- the variables to expand the template- 返回:
- the entity wrapped in a
Future
- 抛出:
RestClientException
getForEntity
<T> ListenableFuture<ResponseEntity<T>> getForEntity(String url, Class<T> responseType, Map<String,?> uriVariables) throws RestClientException
已过时。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.
- 参数:
url
- the URLresponseType
- the type of the return valueuriVariables
- the map containing variables for the URI template- 返回:
- the entity wrapped in a
Future
- 抛出:
RestClientException
getForEntity
<T> ListenableFuture<ResponseEntity<T>> getForEntity(URI url, Class<T> responseType) throws RestClientException
已过时。Asynchronously retrieve a representation by doing a GET on the URL. The response is converted and stored in anResponseEntity
.- 参数:
url
- the URLresponseType
- the type of the return value- 返回:
- the entity wrapped in a
Future
- 抛出:
RestClientException
headForHeaders
ListenableFuture<HttpHeaders> headForHeaders(String url, Object... uriVariables) throws RestClientException
已过时。Asynchronously retrieve all headers of the resource specified by the URI template.URI Template variables are expanded using the given URI variables, if any.
- 参数:
url
- the URLuriVariables
- the variables to expand the template- 返回:
- all HTTP headers of that resource wrapped in a
Future
- 抛出:
RestClientException
headForHeaders
ListenableFuture<HttpHeaders> headForHeaders(String url, Map<String,?> uriVariables) throws RestClientException
已过时。Asynchronously retrieve all headers of the resource specified by the URI template.URI Template variables are expanded using the given map.
- 参数:
url
- the URLuriVariables
- the map containing variables for the URI template- 返回:
- all HTTP headers of that resource wrapped in a
Future
- 抛出:
RestClientException
headForHeaders
ListenableFuture<HttpHeaders> headForHeaders(URI url) throws RestClientException
已过时。Asynchronously retrieve all headers of the resource specified by the URL.- 参数:
url
- the URL- 返回:
- all HTTP headers of that resource wrapped in a
Future
- 抛出:
RestClientException
postForLocation
ListenableFuture<URI> postForLocation(String url, @Nullable HttpEntity<?> request, Object... uriVariables) throws RestClientException
已过时。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.
- 参数:
url
- the URLrequest
- the Object to be POSTed (may benull
)uriVariables
- the variables to expand the template- 返回:
- the value for the
Location
header wrapped in aFuture
- 抛出:
RestClientException
- 另请参阅:
HttpEntity
postForLocation
ListenableFuture<URI> postForLocation(String url, @Nullable HttpEntity<?> request, Map<String,?> uriVariables) throws RestClientException
已过时。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.
- 参数:
url
- the URLrequest
- the Object to be POSTed (may benull
)uriVariables
- the variables to expand the template- 返回:
- the value for the
Location
header wrapped in aFuture
- 抛出:
RestClientException
- 另请参阅:
HttpEntity
postForLocation
ListenableFuture<URI> postForLocation(URI url, @Nullable HttpEntity<?> request) throws RestClientException
已过时。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.- 参数:
url
- the URLrequest
- the Object to be POSTed (may benull
)- 返回:
- the value for the
Location
header wrapped in aFuture
- 抛出:
RestClientException
- 另请参阅:
HttpEntity
postForEntity
<T> ListenableFuture<ResponseEntity<T>> postForEntity(String url, @Nullable HttpEntity<?> request, Class<T> responseType, Object... uriVariables) throws RestClientException
已过时。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.
- 参数:
url
- the URLrequest
- the Object to be POSTed (may benull
)uriVariables
- the variables to expand the template- 返回:
- the entity wrapped in a
Future
- 抛出:
RestClientException
- 另请参阅:
HttpEntity
postForEntity
<T> ListenableFuture<ResponseEntity<T>> postForEntity(String url, @Nullable HttpEntity<?> request, Class<T> responseType, Map<String,?> uriVariables) throws RestClientException
已过时。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.
- 参数:
url
- the URLrequest
- the Object to be POSTed (may benull
)uriVariables
- the variables to expand the template- 返回:
- the entity wrapped in a
Future
- 抛出:
RestClientException
- 另请参阅:
HttpEntity
postForEntity
<T> ListenableFuture<ResponseEntity<T>> postForEntity(URI url, @Nullable HttpEntity<?> request, Class<T> responseType) throws RestClientException
已过时。Create a new resource by POSTing the given object to the URL, and asynchronously returns the response asResponseEntity
.- 参数:
url
- the URLrequest
- the Object to be POSTed (may benull
)- 返回:
- the entity wrapped in a
Future
- 抛出:
RestClientException
- 另请参阅:
HttpEntity
put
ListenableFuture<?> put(String url, @Nullable HttpEntity<?> request, Object... uriVariables) throws RestClientException
已过时。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.- 参数:
url
- the URLrequest
- the Object to be PUT (may benull
)uriVariables
- the variables to expand the template- 抛出:
RestClientException
- 另请参阅:
HttpEntity
put
ListenableFuture<?> put(String url, @Nullable HttpEntity<?> request, Map<String,?> uriVariables) throws RestClientException
已过时。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.- 参数:
url
- the URLrequest
- the Object to be PUT (may benull
)uriVariables
- the variables to expand the template- 抛出:
RestClientException
- 另请参阅:
HttpEntity
put
ListenableFuture<?> put(URI url, @Nullable HttpEntity<?> request) throws RestClientException
已过时。Creates a new resource by PUTting the given object to URL.The Future will return a
null
result upon completion.- 参数:
url
- the URLrequest
- the Object to be PUT (may benull
)- 抛出:
RestClientException
- 另请参阅:
HttpEntity
delete
ListenableFuture<?> delete(String url, Object... uriVariables) throws RestClientException
已过时。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.- 参数:
url
- the URLuriVariables
- the variables to expand in the template- 抛出:
RestClientException
delete
ListenableFuture<?> delete(String url, Map<String,?> uriVariables) throws RestClientException
已过时。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.- 参数:
url
- the URLuriVariables
- the variables to expand in the template- 抛出:
RestClientException
delete
ListenableFuture<?> delete(URI url) throws RestClientException
已过时。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.- 参数:
url
- the URL- 抛出:
RestClientException
optionsForAllow
ListenableFuture<Set<HttpMethod>> optionsForAllow(String url, Object... uriVariables) throws RestClientException
已过时。Asynchronously return the value of the Allow header for the given URI.URI Template variables are expanded using the given URI variables, if any.
- 参数:
url
- the URLuriVariables
- the variables to expand in the template- 返回:
- the value of the allow header wrapped in a
Future
- 抛出:
RestClientException
optionsForAllow
ListenableFuture<Set<HttpMethod>> optionsForAllow(String url, Map<String,?> uriVariables) throws RestClientException
已过时。Asynchronously return the value of the Allow header for the given URI.URI Template variables are expanded using the given map.
- 参数:
url
- the URLuriVariables
- the variables to expand in the template- 返回:
- the value of the allow header wrapped in a
Future
- 抛出:
RestClientException
optionsForAllow
ListenableFuture<Set<HttpMethod>> optionsForAllow(URI url) throws RestClientException
已过时。Asynchronously return the value of the Allow header for the given URL.- 参数:
url
- the URL- 返回:
- the value of the allow header wrapped in a
Future
- 抛出:
RestClientException
exchange
<T> ListenableFuture<ResponseEntity<T>> exchange(String url, HttpMethod method, @Nullable HttpEntity<?> requestEntity, Class<T> responseType, Object... uriVariables) throws RestClientException
已过时。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.
- 参数:
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- 返回:
- the response as entity wrapped in a
Future
- 抛出:
RestClientException
exchange
<T> ListenableFuture<ResponseEntity<T>> exchange(String url, HttpMethod method, @Nullable HttpEntity<?> requestEntity, Class<T> responseType, Map<String,?> uriVariables) throws RestClientException
已过时。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.
- 参数:
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- 返回:
- the response as entity wrapped in a
Future
- 抛出:
RestClientException
exchange
<T> ListenableFuture<ResponseEntity<T>> exchange(URI url, HttpMethod method, @Nullable HttpEntity<?> requestEntity, Class<T> responseType) throws RestClientException
已过时。Asynchronously execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response asResponseEntity
.- 参数:
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- 返回:
- the response as entity wrapped in a
Future
- 抛出:
RestClientException
exchange
<T> ListenableFuture<ResponseEntity<T>> exchange(String url, HttpMethod method, @Nullable HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType, Object... uriVariables) throws RestClientException
已过时。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);
- 参数:
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- 返回:
- the response as entity wrapped in a
Future
- 抛出:
RestClientException
exchange
<T> ListenableFuture<ResponseEntity<T>> exchange(String url, HttpMethod method, @Nullable HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType, Map<String,?> uriVariables) throws RestClientException
已过时。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);
- 参数:
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- 返回:
- the response as entity wrapped in a
Future
- 抛出:
RestClientException
exchange
<T> ListenableFuture<ResponseEntity<T>> exchange(URI url, HttpMethod method, @Nullable HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType) throws RestClientException
已过时。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);
- 参数:
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- 返回:
- the response as entity wrapped in a
Future
- 抛出:
RestClientException
execute
<T> ListenableFuture<T> execute(String url, HttpMethod method, @Nullable AsyncRequestCallback requestCallback, @Nullable ResponseExtractor<T> responseExtractor, Object... uriVariables) throws RestClientException
已过时。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.
- 参数:
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- 返回:
- an arbitrary object, as returned by the
ResponseExtractor
- 抛出:
RestClientException
execute
<T> ListenableFuture<T> execute(String url, HttpMethod method, @Nullable AsyncRequestCallback requestCallback, @Nullable ResponseExtractor<T> responseExtractor, Map<String,?> uriVariables) throws RestClientException
已过时。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.
- 参数:
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- 返回:
- an arbitrary object, as returned by the
ResponseExtractor
- 抛出:
RestClientException
execute
<T> ListenableFuture<T> execute(URI url, HttpMethod method, @Nullable AsyncRequestCallback requestCallback, @Nullable ResponseExtractor<T> responseExtractor) throws RestClientException
已过时。Asynchronously execute the HTTP method to the given URL, preparing the request with theAsyncRequestCallback
, and reading the response with aResponseExtractor
.- 参数:
url
- the URLmethod
- the HTTP method (GET, POST, etc)requestCallback
- object that prepares the requestresponseExtractor
- object that extracts the return value from the response- 返回:
- an arbitrary object, as returned by the
ResponseExtractor
- 抛出:
RestClientException