类 AsyncRestTemplate
- java.lang.Object
- org.springframework.http.client.support.AsyncHttpAccessor
- org.springframework.http.client.support.InterceptingAsyncHttpAccessor
- org.springframework.web.client.AsyncRestTemplate
- 所有已实现的接口:
AsyncRestOperations
@Deprecated public class AsyncRestTemplate extends InterceptingAsyncHttpAccessor implements AsyncRestOperations
已过时。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.- 从以下版本开始:
- 4.0
- 作者:
- Arjen Poutsma
- 另请参阅:
RestTemplate
字段概要
从类继承的字段 org.springframework.http.client.support.AsyncHttpAccessor
logger
构造器概要
构造器 构造器 说明 AsyncRestTemplate()
已过时。Create a new instance of theAsyncRestTemplate
using default settings.AsyncRestTemplate(AsyncListenableTaskExecutor taskExecutor)
已过时。Create a new instance of theAsyncRestTemplate
using the givenAsyncTaskExecutor
.AsyncRestTemplate(AsyncClientHttpRequestFactory asyncRequestFactory)
已过时。Create a new instance of theAsyncRestTemplate
using the givenAsyncClientHttpRequestFactory
.AsyncRestTemplate(AsyncClientHttpRequestFactory asyncRequestFactory, ClientHttpRequestFactory syncRequestFactory)
已过时。Creates a new instance of theAsyncRestTemplate
using the given asynchronous and synchronous request factories.AsyncRestTemplate(AsyncClientHttpRequestFactory requestFactory, RestTemplate restTemplate)
已过时。Create a new instance of theAsyncRestTemplate
using the givenAsyncClientHttpRequestFactory
and synchronousRestTemplate
.
方法概要
所有方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 protected <T> AsyncRequestCallback
acceptHeaderRequestCallback(Class<T> responseType)
已过时。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)
已过时。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.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, 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
.ResponseErrorHandler
getErrorHandler()
已过时。Return the error handler.<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.List<HttpMessageConverter<?>>
getMessageConverters()
已过时。Return the message body converters.RestOperations
getRestOperations()
已过时。Expose the synchronous Spring RestTemplate to allow synchronous invocation.UriTemplateHandler
getUriTemplateHandler()
已过时。Return the configured URI template handler.protected ResponseExtractor<HttpHeaders>
headersExtractor()
已过时。Returns a response extractor forHttpHeaders
.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.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, Object... uriVars)
已过时。Asynchronously return the value of the Allow header for the given URI.ListenableFuture<Set<HttpMethod>>
optionsForAllow(String url, Map<String,?> uriVars)
已过时。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... uriVars)
已过时。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)
已过时。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... uriVars)
已过时。Create or update a resource by PUTting the given object to the URI.ListenableFuture<?>
put(String url, HttpEntity<?> request, Map<String,?> uriVars)
已过时。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.protected <T> ResponseExtractor<ResponseEntity<T>>
responseEntityExtractor(Type responseType)
已过时。Returns a response extractor forResponseEntity
.void
setDefaultUriVariables(Map<String,?> defaultUriVariables)
已过时。Configure default URI variable values.void
setErrorHandler(ResponseErrorHandler errorHandler)
已过时。Set the error handler.void
setMessageConverters(List<HttpMessageConverter<?>> messageConverters)
已过时。Set the message body converters to use.void
setUriTemplateHandler(UriTemplateHandler handler)
已过时。This property has the same purpose as the corresponding property on theRestTemplate
.从类继承的方法 org.springframework.http.client.support.InterceptingAsyncHttpAccessor
getAsyncRequestFactory, getInterceptors, setInterceptors
从类继承的方法 org.springframework.http.client.support.AsyncHttpAccessor
createAsyncRequest, setAsyncRequestFactory
构造器详细资料
AsyncRestTemplate
public AsyncRestTemplate()
已过时。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)
已过时。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)
已过时。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)
已过时。Creates a new instance of theAsyncRestTemplate
using the given asynchronous and synchronous request factories.- 参数:
asyncRequestFactory
- the asynchronous request factorysyncRequestFactory
- the synchronous request factory
AsyncRestTemplate
public AsyncRestTemplate(AsyncClientHttpRequestFactory requestFactory, RestTemplate restTemplate)
已过时。Create a new instance of theAsyncRestTemplate
using the givenAsyncClientHttpRequestFactory
and synchronousRestTemplate
.- 参数:
requestFactory
- the asynchronous request factory to userestTemplate
- the synchronous template to use
方法详细资料
setErrorHandler
public void setErrorHandler(ResponseErrorHandler errorHandler)
已过时。Set the error handler.By default, AsyncRestTemplate uses a
DefaultResponseErrorHandler
.
getErrorHandler
public ResponseErrorHandler getErrorHandler()
已过时。Return the error handler.
setDefaultUriVariables
public void setDefaultUriVariables(Map<String,?> defaultUriVariables)
已过时。Configure default URI variable values. This is a shortcut for:DefaultUriTemplateHandler handler = new DefaultUriTemplateHandler(); handler.setDefaultUriVariables(...); AsyncRestTemplate restTemplate = new AsyncRestTemplate(); restTemplate.setUriTemplateHandler(handler);
- 参数:
defaultUriVariables
- the default URI variable values- 从以下版本开始:
- 4.3
setUriTemplateHandler
public void setUriTemplateHandler(UriTemplateHandler handler)
已过时。This property has the same purpose as the corresponding property on theRestTemplate
. For more details seeRestTemplate.setUriTemplateHandler(org.springframework.web.util.UriTemplateHandler)
.- 参数:
handler
- the URI template handler to use
getUriTemplateHandler
public UriTemplateHandler getUriTemplateHandler()
已过时。Return the configured URI template handler.
getRestOperations
public RestOperations getRestOperations()
已过时。从接口复制的说明:AsyncRestOperations
Expose the synchronous Spring RestTemplate to allow synchronous invocation.- 指定者:
getRestOperations
在接口中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
已过时。从接口复制的说明: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.
- 指定者:
getForEntity
在接口中AsyncRestOperations
- 参数:
url
- the URLresponseType
- the type of the return valueuriVariables
- the variables to expand the template- 返回:
- the entity wrapped in a
Future
- 抛出:
RestClientException
getForEntity
public <T> ListenableFuture<ResponseEntity<T>> getForEntity(String url, Class<T> responseType, Map<String,?> uriVariables) throws RestClientException
已过时。从接口复制的说明: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.
- 指定者:
getForEntity
在接口中AsyncRestOperations
- 参数:
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
public <T> ListenableFuture<ResponseEntity<T>> getForEntity(URI url, Class<T> responseType) throws RestClientException
已过时。从接口复制的说明:AsyncRestOperations
Asynchronously retrieve a representation by doing a GET on the URL. The response is converted and stored in anResponseEntity
.- 指定者:
getForEntity
在接口中AsyncRestOperations
- 参数:
url
- the URLresponseType
- the type of the return value- 返回:
- the entity wrapped in a
Future
- 抛出:
RestClientException
headForHeaders
public ListenableFuture<HttpHeaders> headForHeaders(String url, Object... uriVariables) throws RestClientException
已过时。从接口复制的说明: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.
- 指定者:
headForHeaders
在接口中AsyncRestOperations
- 参数:
url
- the URLuriVariables
- the variables to expand the template- 返回:
- all HTTP headers of that resource wrapped in a
Future
- 抛出:
RestClientException
headForHeaders
public ListenableFuture<HttpHeaders> headForHeaders(String url, Map<String,?> uriVariables) throws RestClientException
已过时。从接口复制的说明:AsyncRestOperations
Asynchronously retrieve all headers of the resource specified by the URI template.URI Template variables are expanded using the given map.
- 指定者:
headForHeaders
在接口中AsyncRestOperations
- 参数:
url
- the URLuriVariables
- the map containing variables for the URI template- 返回:
- all HTTP headers of that resource wrapped in a
Future
- 抛出:
RestClientException
headForHeaders
public ListenableFuture<HttpHeaders> headForHeaders(URI url) throws RestClientException
已过时。从接口复制的说明:AsyncRestOperations
Asynchronously retrieve all headers of the resource specified by the URL.- 指定者:
headForHeaders
在接口中AsyncRestOperations
- 参数:
url
- the URL- 返回:
- all HTTP headers of that resource wrapped in a
Future
- 抛出:
RestClientException
postForLocation
public ListenableFuture<URI> postForLocation(String url, @Nullable HttpEntity<?> request, Object... uriVars) throws RestClientException
已过时。从接口复制的说明: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.
- 指定者:
postForLocation
在接口中AsyncRestOperations
- 参数:
url
- the URLrequest
- the Object to be POSTed (may benull
)uriVars
- the variables to expand the template- 返回:
- the value for the
Location
header wrapped in aFuture
- 抛出:
RestClientException
- 另请参阅:
HttpEntity
postForLocation
public ListenableFuture<URI> postForLocation(String url, @Nullable HttpEntity<?> request, Map<String,?> uriVars) throws RestClientException
已过时。从接口复制的说明: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.
- 指定者:
postForLocation
在接口中AsyncRestOperations
- 参数:
url
- the URLrequest
- the Object to be POSTed (may benull
)uriVars
- the variables to expand the template- 返回:
- the value for the
Location
header wrapped in aFuture
- 抛出:
RestClientException
- 另请参阅:
HttpEntity
postForLocation
public ListenableFuture<URI> postForLocation(URI url, @Nullable HttpEntity<?> request) throws RestClientException
已过时。从接口复制的说明: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.- 指定者:
postForLocation
在接口中AsyncRestOperations
- 参数:
url
- the URLrequest
- the Object to be POSTed (may benull
)- 返回:
- the value for the
Location
header wrapped in aFuture
- 抛出:
RestClientException
- 另请参阅:
HttpEntity
postForEntity
public <T> ListenableFuture<ResponseEntity<T>> postForEntity(String url, @Nullable HttpEntity<?> request, Class<T> responseType, Object... uriVariables) throws RestClientException
已过时。从接口复制的说明: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.
- 指定者:
postForEntity
在接口中AsyncRestOperations
- 参数:
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
public <T> ListenableFuture<ResponseEntity<T>> postForEntity(String url, @Nullable HttpEntity<?> request, Class<T> responseType, Map<String,?> uriVariables) throws RestClientException
已过时。从接口复制的说明: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.
- 指定者:
postForEntity
在接口中AsyncRestOperations
- 参数:
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
public <T> ListenableFuture<ResponseEntity<T>> postForEntity(URI url, @Nullable HttpEntity<?> request, Class<T> responseType) throws RestClientException
已过时。从接口复制的说明:AsyncRestOperations
Create a new resource by POSTing the given object to the URL, and asynchronously returns the response asResponseEntity
.- 指定者:
postForEntity
在接口中AsyncRestOperations
- 参数:
url
- the URLrequest
- the Object to be POSTed (may benull
)- 返回:
- the entity wrapped in a
Future
- 抛出:
RestClientException
- 另请参阅:
HttpEntity
put
public ListenableFuture<?> put(String url, @Nullable HttpEntity<?> request, Object... uriVars) throws RestClientException
已过时。从接口复制的说明: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.- 指定者:
put
在接口中AsyncRestOperations
- 参数:
url
- the URLrequest
- the Object to be PUT (may benull
)uriVars
- the variables to expand the template- 抛出:
RestClientException
- 另请参阅:
HttpEntity
put
public ListenableFuture<?> put(String url, @Nullable HttpEntity<?> request, Map<String,?> uriVars) throws RestClientException
已过时。从接口复制的说明: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.- 指定者:
put
在接口中AsyncRestOperations
- 参数:
url
- the URLrequest
- the Object to be PUT (may benull
)uriVars
- the variables to expand the template- 抛出:
RestClientException
- 另请参阅:
HttpEntity
put
public ListenableFuture<?> put(URI url, @Nullable HttpEntity<?> request) throws RestClientException
已过时。从接口复制的说明:AsyncRestOperations
Creates a new resource by PUTting the given object to URL.The Future will return a
null
result upon completion.- 指定者:
put
在接口中AsyncRestOperations
- 参数:
url
- the URLrequest
- the Object to be PUT (may benull
)- 抛出:
RestClientException
- 另请参阅:
HttpEntity
delete
public ListenableFuture<?> delete(String url, Object... uriVariables) throws RestClientException
已过时。从接口复制的说明: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.- 指定者:
delete
在接口中AsyncRestOperations
- 参数:
url
- the URLuriVariables
- the variables to expand in the template- 抛出:
RestClientException
delete
public ListenableFuture<?> delete(String url, Map<String,?> uriVariables) throws RestClientException
已过时。从接口复制的说明: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.- 指定者:
delete
在接口中AsyncRestOperations
- 参数:
url
- the URLuriVariables
- the variables to expand in the template- 抛出:
RestClientException
delete
public ListenableFuture<?> delete(URI url) throws RestClientException
已过时。从接口复制的说明: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.- 指定者:
delete
在接口中AsyncRestOperations
- 参数:
url
- the URL- 抛出:
RestClientException
optionsForAllow
public ListenableFuture<Set<HttpMethod>> optionsForAllow(String url, Object... uriVars) throws RestClientException
已过时。从接口复制的说明: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.
- 指定者:
optionsForAllow
在接口中AsyncRestOperations
- 参数:
url
- the URLuriVars
- the variables to expand in the template- 返回:
- the value of the allow header wrapped in a
Future
- 抛出:
RestClientException
optionsForAllow
public ListenableFuture<Set<HttpMethod>> optionsForAllow(String url, Map<String,?> uriVars) throws RestClientException
已过时。从接口复制的说明:AsyncRestOperations
Asynchronously return the value of the Allow header for the given URI.URI Template variables are expanded using the given map.
- 指定者:
optionsForAllow
在接口中AsyncRestOperations
- 参数:
url
- the URLuriVars
- the variables to expand in the template- 返回:
- the value of the allow header wrapped in a
Future
- 抛出:
RestClientException
optionsForAllow
public ListenableFuture<Set<HttpMethod>> optionsForAllow(URI url) throws RestClientException
已过时。从接口复制的说明:AsyncRestOperations
Asynchronously return the value of the Allow header for the given URL.- 指定者:
optionsForAllow
在接口中AsyncRestOperations
- 参数:
url
- the URL- 返回:
- the value of the allow header wrapped in a
Future
- 抛出:
RestClientException
exchange
public <T> ListenableFuture<ResponseEntity<T>> exchange(String url, HttpMethod method, @Nullable HttpEntity<?> requestEntity, Class<T> responseType, Object... uriVariables) throws RestClientException
已过时。从接口复制的说明: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.
- 指定者:
exchange
在接口中AsyncRestOperations
- 参数:
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
public <T> ListenableFuture<ResponseEntity<T>> exchange(String url, HttpMethod method, @Nullable HttpEntity<?> requestEntity, Class<T> responseType, Map<String,?> uriVariables) throws RestClientException
已过时。从接口复制的说明: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.
- 指定者:
exchange
在接口中AsyncRestOperations
- 参数:
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
public <T> ListenableFuture<ResponseEntity<T>> exchange(URI url, HttpMethod method, @Nullable HttpEntity<?> requestEntity, Class<T> responseType) throws RestClientException
已过时。从接口复制的说明:AsyncRestOperations
Asynchronously execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response asResponseEntity
.- 指定者:
exchange
在接口中AsyncRestOperations
- 参数:
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
public <T> ListenableFuture<ResponseEntity<T>> exchange(String url, HttpMethod method, @Nullable HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType, Object... uriVariables) throws RestClientException
已过时。从接口复制的说明: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);
- 指定者:
exchange
在接口中AsyncRestOperations
- 参数:
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
public <T> ListenableFuture<ResponseEntity<T>> exchange(String url, HttpMethod method, @Nullable HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType, Map<String,?> uriVariables) throws RestClientException
已过时。从接口复制的说明: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);
- 指定者:
exchange
在接口中AsyncRestOperations
- 参数:
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
public <T> ListenableFuture<ResponseEntity<T>> exchange(URI url, HttpMethod method, @Nullable HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType) throws RestClientException
已过时。从接口复制的说明: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);
- 指定者:
exchange
在接口中AsyncRestOperations
- 参数:
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
public <T> ListenableFuture<T> execute(String url, HttpMethod method, @Nullable AsyncRequestCallback requestCallback, @Nullable ResponseExtractor<T> responseExtractor, Object... uriVariables) throws RestClientException
已过时。从接口复制的说明: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.
- 指定者:
execute
在接口中AsyncRestOperations
- 参数:
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
public <T> ListenableFuture<T> execute(String url, HttpMethod method, @Nullable AsyncRequestCallback requestCallback, @Nullable ResponseExtractor<T> responseExtractor, Map<String,?> uriVariables) throws RestClientException
已过时。从接口复制的说明: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.
- 指定者:
execute
在接口中AsyncRestOperations
- 参数:
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
public <T> ListenableFuture<T> execute(URI url, HttpMethod method, @Nullable AsyncRequestCallback requestCallback, @Nullable ResponseExtractor<T> responseExtractor) throws RestClientException
已过时。从接口复制的说明:AsyncRestOperations
Asynchronously execute the HTTP method to the given URL, preparing the request with theAsyncRequestCallback
, and reading the response with aResponseExtractor
.- 指定者:
execute
在接口中AsyncRestOperations
- 参数:
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
doExecute
protected <T> ListenableFuture<T> doExecute(URI url, HttpMethod method, @Nullable AsyncRequestCallback requestCallback, @Nullable ResponseExtractor<T> responseExtractor) throws RestClientException
已过时。Execute the given method on the provided URI. TheClientHttpRequest
is processed using theRequestCallback
; the response with theResponseExtractor
.- 参数:
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
)- 返回:
- an arbitrary object, as returned by the
ResponseExtractor
- 抛出:
RestClientException
acceptHeaderRequestCallback
protected <T> AsyncRequestCallback acceptHeaderRequestCallback(Class<T> responseType)
已过时。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)
已过时。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)
已过时。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 forResponseEntity
.
headersExtractor
protected ResponseExtractor<HttpHeaders> headersExtractor()
已过时。Returns a response extractor forHttpHeaders
.