有情有义的山羊 · 【sprinb-boot】排除/不加载某些B ...· 2 周前 · |
有胆有识的橡皮擦 · xamarin.form获取app的当前运行 ...· 5 月前 · |
憨厚的打火机 · 土豪武侠梦txt,简介内容 - 快看漫画· 1 年前 · |
仗义的炒面 · 《紧急救援》影评 感谢有你们才有我们的明天 ...· 1 年前 · |
一身肌肉的稀饭 · 蛇精是种病 - 🌈️包子漫畫· 1 年前 · |
温文尔雅的灌汤包 · 轻之国度被查事件 - 萌娘百科 ...· 1 年前 · |
object resttemplate |
https://docs.spring.io/spring-framework/docs/3.2.2.RELEASE_to_4.0.0.M1/Spring%20Framework%203.2.2.RELEASE/org/springframework/web/ |
爱健身的眼镜
2 月前 |
The main entry points of this template are the methods named after the six main HTTP methods:
HTTP methodRestTemplate methods
DELETE
delete(java.lang.String, java.lang.Object...)
GET
getForObject(java.lang.String, java.lang.Class<T>, java.lang.Object...)
getForEntity(java.lang.String, java.lang.Class<T>, java.lang.Object...)
HEAD
headForHeaders(java.lang.String, java.lang.Object...)
OPTIONS
optionsForAllow(java.lang.String, java.lang.Object...)
POST
postForLocation(java.lang.String, java.lang.Object, java.lang.Object...)
postForObject(java.lang.String, java.lang.Object, java.lang.Class<T>, java.lang.Object...)
PUT
put(java.lang.String, java.lang.Object, java.lang.Object...)
any
exchange(java.lang.String, org.springframework.http.HttpMethod, org.springframework.http.HttpEntity<?>, java.lang.Class<T>, java.lang.Object...)
execute(java.lang.String, org.springframework.http.HttpMethod, org.springframework.web.client.RequestCallback, org.springframework.web.client.ResponseExtractor<T>, java.lang.Object...)
The
exchange
and
execute
methods are generalized versions of the more specific methods listed
above them. They support additional, less frequently used combinations including support for requests using the
HTTP PATCH method. However, note that the underlying HTTP library must also support the desired combination.
For each of these HTTP methods, there are three corresponding Java methods in the
RestTemplate
. Two
variant take a
String
URI as first argument (eg.
getForObject(String, Class, Object[])
,
getForObject(String, Class, Map)
), and are capable of substituting any
URI templates
in
that URL using either a
String
variable arguments array, or a
Map<String, String>
. The string varargs
variant expands the given template variables in order, so that
String result = restTemplate.getForObject("http://example.com/hotels/{hotel}/bookings/{booking}", String.class,"42",
"21");
will perform a GET on
http://example.com/hotels/42/bookings/21
. The map variant expands the template based on
variable name, and is therefore more useful when using many variables, or when a single variable is used multiple
times. For example:
Map<String, String> vars = Collections.singletonMap("hotel", "42");
String result = restTemplate.getForObject("http://example.com/hotels/{hotel}/rooms/{hotel}", String.class, vars);
will perform a GET on
http://example.com/hotels/42/rooms/42
. Alternatively, there are
URI
variant
methods (
getForObject(URI, Class)
), which do not allow for URI templates, but allow you to reuse a single,
expanded URI multiple times.
Furthermore, the
String
-argument methods assume that the URL String is unencoded. This means that
restTemplate.getForObject("http://example.com/hotel list");
will perform a GET on
http://example.com/hotel%20list
. As a result, any URL passed that is already encoded
will be encoded twice (i.e.
http://example.com/hotel%20list
will become
http://example.com/hotel%2520list
). If this behavior is undesirable, use the
URI
-argument methods, which
will not perform any URL encoding.
Objects passed to and returned from these methods are converted to and from HTTP messages by
HttpMessageConverter
instances. Converters for the main mime types are registered by default, but you can also write
your own converter and register it via the
messageConverters
bean property.
This template uses a
SimpleClientHttpRequestFactory
and a
DefaultResponseErrorHandler
as default strategies for creating HTTP connections or handling HTTP errors,
respectively. These defaults can be overridden through the
requestFactory
and
errorHandler
bean properties.
HttpMessageConverter
,
RequestCallback
,
ResponseExtractor
,
ResponseErrorHandler
<T>
ResponseEntity
<T>
exchange
(java.lang.String url,
HttpMethod
method,
HttpEntity
<?> requestEntity,
java.lang.Class<T> responseType,
java.util.Map<java.lang.String,?> uriVariables)
ResponseEntity
.
<T>
ResponseEntity
<T>
exchange
(java.lang.String url,
HttpMethod
method,
HttpEntity
<?> requestEntity,
java.lang.Class<T> responseType,
java.lang.Object... uriVariables)
ResponseEntity
.
<T>
ResponseEntity
<T>
exchange
(java.lang.String url,
HttpMethod
method,
HttpEntity
<?> requestEntity,
ParameterizedTypeReference
<T> responseType,
java.util.Map<java.lang.String,?> uriVariables)
ResponseEntity
.
<T>
ResponseEntity
<T>
exchange
(java.lang.String url,
HttpMethod
method,
HttpEntity
<?> requestEntity,
ParameterizedTypeReference
<T> responseType,
java.lang.Object... uriVariables)
ResponseEntity
.
<T>
ResponseEntity
<T>
exchange
(java.net.URI url,
HttpMethod
method,
HttpEntity
<?> requestEntity,
java.lang.Class<T> responseType)
ResponseEntity
.
<T>
ResponseEntity
<T>
exchange
(java.net.URI url,
HttpMethod
method,
HttpEntity
<?> requestEntity,
ParameterizedTypeReference
<T> responseType)
ResponseEntity
.
execute
(java.lang.String url,
HttpMethod
method,
RequestCallback
requestCallback,
ResponseExtractor
<T> responseExtractor,
java.util.Map<java.lang.String,?> urlVariables)
RequestCallback
, and reading the response with a
ResponseExtractor
.
execute
(java.lang.String url,
HttpMethod
method,
RequestCallback
requestCallback,
ResponseExtractor
<T> responseExtractor,
java.lang.Object... urlVariables)
RequestCallback
, and reading the response with a
ResponseExtractor
.
execute
(java.net.URI url,
HttpMethod
method,
RequestCallback
requestCallback,
ResponseExtractor
<T> responseExtractor)
RequestCallback
, and reading the response with a
ResponseExtractor
.
ResponseErrorHandler
getErrorHandler
()
<T>
ResponseEntity
<T>
getForEntity
(java.lang.String url,
java.lang.Class<T> responseType,
java.util.Map<java.lang.String,?> urlVariables)
<T>
ResponseEntity
<T>
getForEntity
(java.lang.String url,
java.lang.Class<T> responseType,
java.lang.Object... urlVariables)
<T>
ResponseEntity
<T>
getForEntity
(java.net.URI url,
java.lang.Class<T> responseType)
getForObject
(java.lang.String url,
java.lang.Class<T> responseType,
java.util.Map<java.lang.String,?> urlVariables)
getForObject
(java.lang.String url,
java.lang.Class<T> responseType,
java.lang.Object... urlVariables)
getForObject
(java.net.URI url,
java.lang.Class<T> responseType)
java.util.List<
HttpMessageConverter
<?>>
getMessageConverters
()
private void
handleResponseError
(
HttpMethod
method,
java.net.URI url,
ClientHttpResponse
response)
HttpHeaders
headForHeaders
(java.lang.String url,
java.util.Map<java.lang.String,?> urlVariables)
HttpHeaders
headForHeaders
(java.lang.String url,
java.lang.Object... urlVariables)
HttpHeaders
headForHeaders
(java.net.URI url)
private void
logResponseStatus
(
HttpMethod
method,
java.net.URI url,
ClientHttpResponse
response)
java.util.Set<
HttpMethod
>
optionsForAllow
(java.lang.String url,
java.util.Map<java.lang.String,?> urlVariables)
java.util.Set<
HttpMethod
>
optionsForAllow
(java.lang.String url,
java.lang.Object... urlVariables)
java.util.Set<
HttpMethod
>
optionsForAllow
(java.net.URI url)
<T>
ResponseEntity
<T>
postForEntity
(java.lang.String url,
java.lang.Object request,
java.lang.Class<T> responseType,
java.util.Map<java.lang.String,?> uriVariables)
HttpEntity
.
<T>
ResponseEntity
<T>
postForEntity
(java.lang.String url,
java.lang.Object request,
java.lang.Class<T> responseType,
java.lang.Object... uriVariables)
ResponseEntity
.
<T>
ResponseEntity
<T>
postForEntity
(java.net.URI url,
java.lang.Object request,
java.lang.Class<T> responseType)
ResponseEntity
.
java.net.URI
postForLocation
(java.lang.String url,
java.lang.Object request,
java.util.Map<java.lang.String,?> urlVariables)
Location
header.
java.net.URI
postForLocation
(java.lang.String url,
java.lang.Object request,
java.lang.Object... urlVariables)
Location
header.
java.net.URI
postForLocation
(java.net.URI url,
java.lang.Object request)
Location
header.
postForObject
(java.lang.String url,
java.lang.Object request,
java.lang.Class<T> responseType,
java.util.Map<java.lang.String,?> uriVariables)
postForObject
(java.lang.String url,
java.lang.Object request,
java.lang.Class<T> responseType,
java.lang.Object... uriVariables)
postForObject
(java.net.URI url,
java.lang.Object request,
java.lang.Class<T> responseType)
put
(java.lang.String url,
java.lang.Object request,
java.util.Map<java.lang.String,?> urlVariables)
put
(java.lang.String url,
java.lang.Object request,
java.lang.Object... urlVariables)
put
(java.net.URI url,
java.lang.Object request)
setErrorHandler
(
ResponseErrorHandler
errorHandler)
setMessageConverters
(java.util.List<
HttpMessageConverter
<?>> messageConverters)
getInterceptors
,
getRequestFactory
,
setInterceptors
public RestTemplate(ClientHttpRequestFactory requestFactory)
RestTemplate
based on the given
ClientHttpRequestFactory
.
requestFactory
- HTTP request factory to use
SimpleClientHttpRequestFactory
,
CommonsClientHttpRequestFactory
public void setMessageConverters(java.util.List<HttpMessageConverter<?>> messageConverters)
public <T> T getForObject(java.lang.String url, java.lang.Class<T> responseType, java.lang.Object... urlVariables) throws RestClientException
RestOperations
URI Template variables are expanded using the given URI variables, if any.
getForObject
in interface
RestOperations
url
- the URL
responseType
- the type of the return value
urlVariables
- the variables to expand the template
RestClientException
public <T> T getForObject(java.lang.String url, java.lang.Class<T> responseType, java.util.Map<java.lang.String,?> urlVariables) throws RestClientException
RestOperations
URI Template variables are expanded using the given map.
getForObject
in interface
RestOperations
url
- the URL
responseType
- the type of the return value
urlVariables
- the map containing variables for the URI template
RestClientException
public <T> T getForObject(java.net.URI url, java.lang.Class<T> responseType) throws RestClientException
RestOperations
getForObject
in interface
RestOperations
url
- the URL
responseType
- the type of the return value
RestClientException
public <T> ResponseEntity<T> getForEntity(java.lang.String url, java.lang.Class<T> responseType, java.lang.Object... urlVariables) throws RestClientException
RestOperations
ResponseEntity
.
URI Template variables are expanded using the given URI variables, if any.
getForEntity
in interface
RestOperations
url
- the URL
responseType
- the type of the return value
urlVariables
- the variables to expand the template
RestClientException
public <T> ResponseEntity<T> getForEntity(java.lang.String url, java.lang.Class<T> responseType, java.util.Map<java.lang.String,?> urlVariables) throws RestClientException
RestOperations
ResponseEntity
.
URI Template variables are expanded using the given map.
getForEntity
in interface
RestOperations
url
- the URL
responseType
- the type of the return value
urlVariables
- the map containing variables for the URI template
RestClientException
public <T> ResponseEntity<T> getForEntity(java.net.URI url, java.lang.Class<T> responseType) throws RestClientException
RestOperations
ResponseEntity
.
getForEntity
in interface
RestOperations
url
- the URL
responseType
- the type of the return value
RestClientException
public HttpHeaders headForHeaders(java.lang.String url, java.lang.Object... urlVariables) throws RestClientException
RestOperations
URI Template variables are expanded using the given URI variables, if any.
headForHeaders
in interface
RestOperations
url
- the URL
urlVariables
- the variables to expand the template
RestClientException
public HttpHeaders headForHeaders(java.lang.String url, java.util.Map<java.lang.String,?> urlVariables) throws RestClientException
RestOperations
URI Template variables are expanded using the given map.
headForHeaders
in interface
RestOperations
url
- the URL
urlVariables
- the map containing variables for the URI template
RestClientException
public HttpHeaders headForHeaders(java.net.URI url) throws RestClientException
RestOperations
headForHeaders
in interface
RestOperations
url
- the URL
RestClientException
public java.net.URI postForLocation(java.lang.String url, java.lang.Object request, java.lang.Object... urlVariables) throws RestClientException
RestOperations
Location
header. This header typically indicates where the new resource is stored.
URI Template variables are expanded using the given URI variables, if any.
The
request
parameter can be a
HttpEntity
in order to
add additional HTTP headers to the request.
postForLocation
in interface
RestOperations
url
- the URL
request
- the Object to be POSTed, may be
null
urlVariables
- the variables to expand the template
Location
header
RestClientException
HttpEntity
public java.net.URI postForLocation(java.lang.String url, java.lang.Object request, java.util.Map<java.lang.String,?> urlVariables) throws RestClientException
RestOperations
Location
header. This header typically indicates where the new resource is stored.
URI Template variables are expanded using the given map.
The
request
parameter can be a
HttpEntity
in order to
add additional HTTP headers to the request.
postForLocation
in interface
RestOperations
url
- the URL
request
- the Object to be POSTed, may be
null
urlVariables
- the variables to expand the template
Location
header
RestClientException
HttpEntity
public java.net.URI postForLocation(java.net.URI url, java.lang.Object request) throws RestClientException
RestOperations
Location
header. This header typically indicates where the new resource is stored.
The
request
parameter can be a
HttpEntity
in order to
add additional HTTP headers to the request.
postForLocation
in interface
RestOperations
url
- the URL
request
- the Object to be POSTed, may be
null
Location
header
RestClientException
HttpEntity
public <T> T postForObject(java.lang.String url, java.lang.Object request, java.lang.Class<T> responseType, java.lang.Object... uriVariables) throws RestClientException
RestOperations
URI Template variables are expanded using the given URI variables, if any.
The
request
parameter can be a
HttpEntity
in order to
add additional HTTP headers to the request.
postForObject
in interface
RestOperations
url
- the URL
request
- the Object to be POSTed, may be
null
responseType
- the type of the return value
uriVariables
- the variables to expand the template
RestClientException
HttpEntity
public <T> T postForObject(java.lang.String url, java.lang.Object request, java.lang.Class<T> responseType, java.util.Map<java.lang.String,?> uriVariables) throws RestClientException
RestOperations
URI Template variables are expanded using the given map.
The
request
parameter can be a
HttpEntity
in order to
add additional HTTP headers to the request.
postForObject
in interface
RestOperations
url
- the URL
request
- the Object to be POSTed, may be
null
responseType
- the type of the return value
uriVariables
- the variables to expand the template
RestClientException
HttpEntity
public <T> T postForObject(java.net.URI url, java.lang.Object request, java.lang.Class<T> responseType) throws RestClientException
RestOperations
The
request
parameter can be a
HttpEntity
in order to
add additional HTTP headers to the request.
postForObject
in interface
RestOperations
url
- the URL
request
- the Object to be POSTed, may be
null
responseType
- the type of the return value
RestClientException
HttpEntity
public <T> ResponseEntity<T> postForEntity(java.lang.String url, java.lang.Object request, java.lang.Class<T> responseType, java.lang.Object... uriVariables) throws RestClientException
RestOperations
ResponseEntity
.
URI Template variables are expanded using the given URI variables, if any.
The
request
parameter can be a
HttpEntity
in order to
add additional HTTP headers to the request.
postForEntity
in interface
RestOperations
url
- the URL
request
- the Object to be POSTed, may be
null
uriVariables
- the variables to expand the template
RestClientException
HttpEntity
public <T> ResponseEntity<T> postForEntity(java.lang.String url, java.lang.Object request, java.lang.Class<T> responseType, java.util.Map<java.lang.String,?> uriVariables) throws RestClientException
RestOperations
HttpEntity
.
URI Template variables are expanded using the given map.
The
request
parameter can be a
HttpEntity
in order to
add additional HTTP headers to the request.
postForEntity
in interface
RestOperations
url
- the URL
request
- the Object to be POSTed, may be
null
uriVariables
- the variables to expand the template
RestClientException
HttpEntity
public <T> ResponseEntity<T> postForEntity(java.net.URI url, java.lang.Object request, java.lang.Class<T> responseType) throws RestClientException
RestOperations
ResponseEntity
.
The
request
parameter can be a
HttpEntity
in order to
add additional HTTP headers to the request.
postForEntity
in interface
RestOperations
url
- the URL
request
- the Object to be POSTed, may be
null
RestClientException
HttpEntity
public void put(java.lang.String url, java.lang.Object request, java.lang.Object... urlVariables) throws RestClientException
RestOperations
URI Template variables are expanded using the given URI variables, if any.
The
request
parameter can be a
HttpEntity
in order to
add additional HTTP headers to the request.
put
in interface
RestOperations
url
- the URL
request
- the Object to be PUT, may be
null
urlVariables
- the variables to expand the template
RestClientException
HttpEntity
public void put(java.lang.String url, java.lang.Object request, java.util.Map<java.lang.String,?> urlVariables) throws RestClientException
RestOperations
URI Template variables are expanded using the given map.
The
request
parameter can be a
HttpEntity
in order to
add additional HTTP headers to the request.
put
in interface
RestOperations
url
- the URL
request
- the Object to be PUT, may be
null
urlVariables
- the variables to expand the template
RestClientException
HttpEntity
RestOperations
The
request
parameter can be a
HttpEntity
in order to
add additional HTTP headers to the request.
put
in interface
RestOperations
url
- the URL
request
- the Object to be PUT, may be
null
RestClientException
HttpEntity
public void delete(java.lang.String url, java.lang.Object... urlVariables) throws RestClientException
RestOperations
URI Template variables are expanded using the given URI variables, if any.
delete
in interface
RestOperations
url
- the URL
urlVariables
- the variables to expand in the template
RestClientException
public void delete(java.lang.String url, java.util.Map<java.lang.String,?> urlVariables) throws RestClientException
RestOperations
URI Template variables are expanded using the given map.
delete
in interface
RestOperations
url
- the URL
urlVariables
- the variables to expand the template
RestClientException
public void delete(java.net.URI url) throws RestClientException
RestOperations
delete
in interface
RestOperations
url
- the URL
RestClientException
public java.util.Set<HttpMethod> optionsForAllow(java.lang.String url, java.lang.Object... urlVariables) throws RestClientException
RestOperations
URI Template variables are expanded using the given URI variables, if any.
optionsForAllow
in interface
RestOperations
url
- the URL
urlVariables
- the variables to expand in the template
RestClientException
public java.util.Set<HttpMethod> optionsForAllow(java.lang.String url, java.util.Map<java.lang.String,?> urlVariables) throws RestClientException
RestOperations
URI Template variables are expanded using the given map.
optionsForAllow
in interface
RestOperations
url
- the URL
urlVariables
- the variables to expand in the template
RestClientException
public java.util.Set<HttpMethod> optionsForAllow(java.net.URI url) throws RestClientException
RestOperations
optionsForAllow
in interface
RestOperations
url
- the URL
RestClientException
public <T> ResponseEntity<T> exchange(java.lang.String url, HttpMethod method, HttpEntity<?> requestEntity, java.lang.Class<T> responseType, java.lang.Object... uriVariables) throws RestClientException
RestOperations
ResponseEntity
.
URI Template variables are expanded using the given URI variables, if any.
exchange
in interface
RestOperations
url
- the URL
method
- the HTTP method (GET, POST, etc)
requestEntity
- the entity (headers and/or body) to write to the request, may be
null
responseType
- the type of the return value
uriVariables
- the variables to expand in the template
RestClientException
public <T> ResponseEntity<T> exchange(java.lang.String url, HttpMethod method, HttpEntity<?> requestEntity, java.lang.Class<T> responseType, java.util.Map<java.lang.String,?> uriVariables) throws RestClientException
RestOperations
ResponseEntity
.
URI Template variables are expanded using the given URI variables, if any.
exchange
in interface
RestOperations
url
- the URL
method
- the HTTP method (GET, POST, etc)
requestEntity
- the entity (headers and/or body) to write to the request, may be
null
responseType
- the type of the return value
uriVariables
- the variables to expand in the template
RestClientException
public <T> ResponseEntity<T> exchange(java.net.URI url, HttpMethod method, HttpEntity<?> requestEntity, java.lang.Class<T> responseType) throws RestClientException
RestOperations
ResponseEntity
.
exchange
in interface
RestOperations
url
- the URL
method
- the HTTP method (GET, POST, etc)
requestEntity
- the entity (headers and/or body) to write to the request, may be
null
responseType
- the type of the return value
RestClientException
public <T> ResponseEntity<T> exchange(java.lang.String url, HttpMethod method, HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType, java.lang.Object... uriVariables) throws RestClientException
RestOperations
ResponseEntity
.
The given
ParameterizedTypeReference
is used to pass generic type information:
ParameterizedTypeReference<List<MyBean>> myBean = new ParameterizedTypeReference<List<MyBean>>() {};
ResponseEntity<List<MyBean>> response = template.exchange("http://example.com",HttpMethod.GET, null, myBean);
exchange
in interface
RestOperations
url
- the URL
method
- the HTTP method (GET, POST, etc)
requestEntity
- the entity (headers and/or body) to write to the
request, may be
null
responseType
- the type of the return value
uriVariables
- the variables to expand in the template
RestClientException
public <T> ResponseEntity<T> exchange(java.lang.String url, HttpMethod method, HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType, java.util.Map<java.lang.String,?> uriVariables) throws RestClientException
RestOperations
ResponseEntity
.
The given
ParameterizedTypeReference
is used to pass generic type information:
ParameterizedTypeReference<List<MyBean>> myBean = new ParameterizedTypeReference<List<MyBean>>() {};
ResponseEntity<List<MyBean>> response = template.exchange("http://example.com",HttpMethod.GET, null, myBean);
exchange
in interface
RestOperations
url
- the URL
method
- the HTTP method (GET, POST, etc)
requestEntity
- the entity (headers and/or body) to write to the request, may be
null
responseType
- the type of the return value
uriVariables
- the variables to expand in the template
RestClientException
public <T> ResponseEntity<T> exchange(java.net.URI url, HttpMethod method, HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType) throws RestClientException
RestOperations
ResponseEntity
.
The given
ParameterizedTypeReference
is used to pass generic type information:
ParameterizedTypeReference<List<MyBean>> myBean = new ParameterizedTypeReference<List<MyBean>>() {};
ResponseEntity<List<MyBean>> response = template.exchange("http://example.com",HttpMethod.GET, null, myBean);
exchange
in interface
RestOperations
url
- the URL
method
- the HTTP method (GET, POST, etc)
requestEntity
- the entity (headers and/or body) to write to the request, may be
null
responseType
- the type of the return value
RestClientException
public <T> T execute(java.lang.String url, HttpMethod method, RequestCallback requestCallback, ResponseExtractor<T> responseExtractor, java.lang.Object... urlVariables) throws RestClientException
RestOperations
RequestCallback
, and reading the response with a
ResponseExtractor
.
URI Template variables are expanded using the given URI variables, if any.
execute
in interface
RestOperations
url
- the URL
method
- the HTTP method (GET, POST, etc)
requestCallback
- object that prepares the request
responseExtractor
- object that extracts the return value from the response
urlVariables
- the variables to expand in the template
ResponseExtractor
RestClientException
public <T> T execute(java.lang.String url, HttpMethod method, RequestCallback requestCallback, ResponseExtractor<T> responseExtractor, java.util.Map<java.lang.String,?> urlVariables) throws RestClientException
RestOperations
RequestCallback
, and reading the response with a
ResponseExtractor
.
URI Template variables are expanded using the given URI variables map.
execute
in interface
RestOperations
url
- the URL
method
- the HTTP method (GET, POST, etc)
requestCallback
- object that prepares the request
responseExtractor
- object that extracts the return value from the response
urlVariables
- the variables to expand in the template
ResponseExtractor
RestClientException
public <T> T execute(java.net.URI url, HttpMethod method, RequestCallback requestCallback, ResponseExtractor<T> responseExtractor) throws RestClientException
RestOperations
RequestCallback
, and reading the response with a
ResponseExtractor
.
execute
in interface
RestOperations
url
- the URL
method
- the HTTP method (GET, POST, etc)
requestCallback
- object that prepares the request
responseExtractor
- object that extracts the return value from the response
ResponseExtractor
RestClientException
protected <T> T doExecute(java.net.URI url, HttpMethod method, RequestCallback requestCallback, ResponseExtractor<T> responseExtractor) throws RestClientException
ClientHttpRequest
is processed using the
RequestCallback
; the response with the
ResponseExtractor
.
url
- the fully-expanded URL to connect to
method
- the HTTP method to execute (GET, POST, etc.)
requestCallback
- object that prepares the request (can be
null
)
responseExtractor
- object that extracts the return value from the response (can be
null
)
ResponseExtractor
RestClientException
private void handleResponseError(HttpMethod method, java.net.URI url, ClientHttpResponse response) throws java.io.IOException
java.io.IOException
憨厚的打火机 · 土豪武侠梦txt,简介内容 - 快看漫画 1 年前 |
仗义的炒面 · 《紧急救援》影评 感谢有你们才有我们的明天 - 知乎 1 年前 |
一身肌肉的稀饭 · 蛇精是种病 - 🌈️包子漫畫 1 年前 |