Interface RestOperations
- All Known Implementing Classes:
RestTemplate
Implemented by RestTemplate. Not often used directly, but a useful
option to enhance testability, as it can easily be mocked or stubbed.
- Since:
- 3.0
- Author:
- Arjen Poutsma, Juergen Hoeller
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated, for removal: This API element is subject to removal in a future version.Delete the resources at the specified URI.voidDeprecated, for removal: This API element is subject to removal in a future version.Delete the resources at the specified URI.voidDeprecated, for removal: This API element is subject to removal in a future version.Delete the resources at the specified URL.<T> ResponseEntity<T> exchange(String url, HttpMethod method, @Nullable HttpEntity<?> requestEntity, Class<T> responseType, @Nullable Object... uriVariables) Deprecated, for removal: This API element is subject to removal in a future version.Execute the HTTP method to the given URI template, writing the given request entity to the request, and return the response asResponseEntity.<T> ResponseEntity<T> exchange(String url, HttpMethod method, @Nullable HttpEntity<?> requestEntity, Class<T> responseType, Map<String, ? extends @Nullable Object> uriVariables) Deprecated, for removal: This API element is subject to removal in a future version.Execute the HTTP method to the given URI template, writing the given request entity to the request, and return the response asResponseEntity.<T> ResponseEntity<T> exchange(String url, HttpMethod method, @Nullable HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType, @Nullable Object... uriVariables) Deprecated, for removal: This API element is subject to removal in a future version.Execute the HTTP method to the given URI template, writing the given request entity to the request, and return the response asResponseEntity.<T> ResponseEntity<T> exchange(String url, HttpMethod method, @Nullable HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType, Map<String, ? extends @Nullable Object> uriVariables) Deprecated, for removal: This API element is subject to removal in a future version.Execute the HTTP method to the given URI template, writing the given request entity to the request, and return the response asResponseEntity.<T> ResponseEntity<T> exchange(URI url, HttpMethod method, @Nullable HttpEntity<?> requestEntity, Class<T> responseType) Deprecated, for removal: This API element is subject to removal in a future version.Execute the HTTP method to the given URI template, writing the given request entity to the request, and return the response asResponseEntity.<T> ResponseEntity<T> exchange(URI url, HttpMethod method, @Nullable HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType) Deprecated, for removal: This API element is subject to removal in a future version.Execute the HTTP method to the given URI template, writing the given request entity to the request, and return the response asResponseEntity.<T> ResponseEntity<T> exchange(RequestEntity<?> requestEntity, Class<T> responseType) Deprecated, for removal: This API element is subject to removal in a future version.Execute the request specified in the givenRequestEntityand return the response asResponseEntity.<T> ResponseEntity<T> exchange(RequestEntity<?> requestEntity, ParameterizedTypeReference<T> responseType) Deprecated, for removal: This API element is subject to removal in a future version.Execute the request specified in the givenRequestEntityand return the response asResponseEntity.<T> @Nullable Texecute(String uriTemplate, HttpMethod method, @Nullable RequestCallback requestCallback, @Nullable ResponseExtractor<T> responseExtractor, @Nullable Object... uriVariables) Deprecated, for removal: This API element is subject to removal in a future version.Execute the HTTP method to the given URI template, preparing the request with theRequestCallback, and reading the response with aResponseExtractor.<T> @Nullable Texecute(String uriTemplate, HttpMethod method, @Nullable RequestCallback requestCallback, @Nullable ResponseExtractor<T> responseExtractor, Map<String, ? extends @Nullable Object> uriVariables) Deprecated, for removal: This API element is subject to removal in a future version.Execute the HTTP method to the given URI template, preparing the request with theRequestCallback, and reading the response with aResponseExtractor.<T> @Nullable Texecute(URI url, HttpMethod method, @Nullable RequestCallback requestCallback, @Nullable ResponseExtractor<T> responseExtractor) Deprecated, for removal: This API element is subject to removal in a future version.Execute the HTTP method to the given URL, preparing the request with theRequestCallback, and reading the response with aResponseExtractor.<T> ResponseEntity<T> getForEntity(String url, Class<T> responseType, @Nullable Object... uriVariables) Deprecated, for removal: This API element is subject to removal in a future version.Retrieve an entity by doing a GET on the specified URL.<T> ResponseEntity<T> getForEntity(String url, Class<T> responseType, Map<String, ? extends @Nullable Object> uriVariables) Deprecated, for removal: This API element is subject to removal in a future version.Retrieve a representation by doing a GET on the URI template.<T> ResponseEntity<T> getForEntity(URI url, Class<T> responseType) Deprecated, for removal: This API element is subject to removal in a future version.Retrieve a representation by doing a GET on the URL.<T> @Nullable TgetForObject(String url, Class<T> responseType, @Nullable Object... uriVariables) Deprecated, for removal: This API element is subject to removal in a future version.Retrieve a representation by doing a GET on the specified URL.<T> @Nullable TgetForObject(String url, Class<T> responseType, Map<String, ? extends @Nullable Object> uriVariables) Deprecated, for removal: This API element is subject to removal in a future version.Retrieve a representation by doing a GET on the URI template.<T> @Nullable TgetForObject(URI url, Class<T> responseType) Deprecated, for removal: This API element is subject to removal in a future version.Retrieve a representation by doing a GET on the URL.headForHeaders(String url, @Nullable Object... uriVariables) Deprecated, for removal: This API element is subject to removal in a future version.Retrieve all headers of the resource specified by the URI template.Deprecated, for removal: This API element is subject to removal in a future version.Retrieve all headers of the resource specified by the URI template.headForHeaders(URI url) Deprecated, for removal: This API element is subject to removal in a future version.Retrieve all headers of the resource specified by the URL.optionsForAllow(String url, @Nullable Object... uriVariables) Deprecated, for removal: This API element is subject to removal in a future version.Return the value of theAllowheader for the given URI.Deprecated, for removal: This API element is subject to removal in a future version.Return the value of theAllowheader for the given URI.optionsForAllow(URI url) Deprecated, for removal: This API element is subject to removal in a future version.Return the value of theAllowheader for the given URL.<T> @Nullable TpatchForObject(String url, @Nullable Object request, Class<T> responseType, @Nullable Object... uriVariables) Deprecated, for removal: This API element is subject to removal in a future version.Update a resource by PATCHing the given object to the URI template, and return the representation found in the response.<T> @Nullable TpatchForObject(String url, @Nullable Object request, Class<T> responseType, Map<String, ? extends @Nullable Object> uriVariables) Deprecated, for removal: This API element is subject to removal in a future version.Update a resource by PATCHing the given object to the URI template, and return the representation found in the response.<T> @Nullable TpatchForObject(URI url, @Nullable Object request, Class<T> responseType) Deprecated, for removal: This API element is subject to removal in a future version.Update a resource by PATCHing the given object to the URL, and return the representation found in the response.<T> ResponseEntity<T> postForEntity(String url, @Nullable Object request, Class<T> responseType, @Nullable Object... uriVariables) Deprecated, for removal: This API element is subject to removal in a future version.Create a new resource by POSTing the given object to the URI template, and return the response asResponseEntity.<T> ResponseEntity<T> postForEntity(String url, @Nullable Object request, Class<T> responseType, Map<String, ? extends @Nullable Object> uriVariables) Deprecated, for removal: This API element is subject to removal in a future version.Create a new resource by POSTing the given object to the URI template, and return the response asHttpEntity.<T> ResponseEntity<T> postForEntity(URI url, @Nullable Object request, Class<T> responseType) Deprecated, for removal: This API element is subject to removal in a future version.Create a new resource by POSTing the given object to the URL, and return the response asResponseEntity.Deprecated, for removal: This API element is subject to removal in a future version.Create a new resource by POSTing the given object to the URI template, and return the value of theLocationheader.postForLocation(String url, @Nullable Object request, Map<String, ? extends @Nullable Object> uriVariables) Deprecated, for removal: This API element is subject to removal in a future version.Create a new resource by POSTing the given object to the URI template, and return the value of theLocationheader.postForLocation(URI url, @Nullable Object request) Deprecated, for removal: This API element is subject to removal in a future version.Create a new resource by POSTing the given object to the URL, and return the value of theLocationheader.<T> @Nullable TpostForObject(String url, @Nullable Object request, Class<T> responseType, @Nullable Object... uriVariables) Deprecated, for removal: This API element is subject to removal in a future version.Create a new resource by POSTing the given object to the URI template, and return the representation found in the response.<T> @Nullable TpostForObject(String url, @Nullable Object request, Class<T> responseType, Map<String, ? extends @Nullable Object> uriVariables) Deprecated, for removal: This API element is subject to removal in a future version.Create a new resource by POSTing the given object to the URI template, and return the representation found in the response.<T> @Nullable TpostForObject(URI url, @Nullable Object request, Class<T> responseType) Deprecated, for removal: This API element is subject to removal in a future version.Create a new resource by POSTing the given object to the URL, and return the representation found in the response.voidDeprecated, for removal: This API element is subject to removal in a future version.Create or update a resource by PUTting the given object to the URI.voidDeprecated, for removal: This API element is subject to removal in a future version.Creates a new resource by PUTting the given object to URI template.voidDeprecated, for removal: This API element is subject to removal in a future version.Creates a new resource by PUTting the given object to URL.
-
Method Details
-
getForObject
<T> @Nullable T getForObject(String url, Class<T> responseType, @Nullable Object... uriVariables) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Retrieve a representation by doing a GET on the specified URL. The response (if any) is converted and returned.URI Template variables are expanded using the given URI variables, if any.
- Parameters:
url- the URLresponseType- the type of the return valueuriVariables- the variables to expand the template- Returns:
- the converted object
- Throws:
RestClientException
-
getForObject
<T> @Nullable T getForObject(String url, Class<T> responseType, Map<String, ? extends @Nullable Object> uriVariables) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Retrieve a representation by doing a GET on the URI template. The response (if any) is converted and returned.URI Template variables are expanded using the given map.
- Parameters:
url- the URLresponseType- the type of the return valueuriVariables- the map containing variables for the URI template- Returns:
- the converted object
- Throws:
RestClientException
-
getForObject
Deprecated, for removal: This API element is subject to removal in a future version.Retrieve a representation by doing a GET on the URL. The response (if any) is converted and returned.- Parameters:
url- the URLresponseType- the type of the return value- Returns:
- the converted object
- Throws:
RestClientException
-
getForEntity
<T> ResponseEntity<T> getForEntity(String url, Class<T> responseType, @Nullable Object... uriVariables) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Retrieve an entity by doing a GET on the specified URL. The response is converted and stored in aResponseEntity.URI Template variables are expanded using the given URI variables, if any.
- Parameters:
url- the URLresponseType- the type of the return valueuriVariables- the variables to expand the template- Returns:
- the entity
- Throws:
RestClientException- Since:
- 3.0.2
-
getForEntity
<T> ResponseEntity<T> getForEntity(String url, Class<T> responseType, Map<String, ? extends @Nullable Object> uriVariables) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Retrieve a representation by doing a GET on the URI template. The response is converted and stored in aResponseEntity.URI Template variables are expanded using the given map.
- Parameters:
url- the URLresponseType- the type of the return valueuriVariables- the map containing variables for the URI template- Returns:
- the converted object
- Throws:
RestClientException- Since:
- 3.0.2
-
getForEntity
Deprecated, for removal: This API element is subject to removal in a future version.Retrieve a representation by doing a GET on the URL. The response is converted and stored in aResponseEntity.- Parameters:
url- the URLresponseType- the type of the return value- Returns:
- the converted object
- Throws:
RestClientException- Since:
- 3.0.2
-
headForHeaders
Deprecated, for removal: This API element is subject to removal in a future version.Retrieve all headers of the resource specified by the URI template.URI Template variables are expanded using the given URI variables, if any.
- Parameters:
url- the URLuriVariables- the variables to expand the template- Returns:
- all HTTP headers of that resource
- Throws:
RestClientException
-
headForHeaders
HttpHeaders headForHeaders(String url, Map<String, ? extends @Nullable Object> uriVariables) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Retrieve all headers of the resource specified by the URI template.URI Template variables are expanded using the given map.
- Parameters:
url- the URLuriVariables- the map containing variables for the URI template- Returns:
- all HTTP headers of that resource
- Throws:
RestClientException
-
headForHeaders
Deprecated, for removal: This API element is subject to removal in a future version.Retrieve all headers of the resource specified by the URL.- Parameters:
url- the URL- Returns:
- all HTTP headers of that resource
- Throws:
RestClientException
-
postForLocation
@Nullable URI postForLocation(String url, @Nullable Object request, @Nullable Object... uriVariables) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Create a new resource by POSTing the given object to the URI template, and return the value of theLocationheader. This header typically indicates where the new resource is stored.URI Template variables are expanded using the given URI variables, if any.
The
requestparameter can be aHttpEntityin order to add additional HTTP headers to the request.The body of the entity, or
requestitself, can be aMultiValueMapto create a multipart request. The values in theMultiValueMapcan be any Object representing the body of the part, or anHttpEntityrepresenting a part with body and headers.- Parameters:
url- the URLrequest- the Object to be POSTed (may benull)uriVariables- the variables to expand the template- Returns:
- the value for the
Locationheader - Throws:
RestClientException- See Also:
-
postForLocation
@Nullable URI postForLocation(String url, @Nullable Object request, Map<String, ? extends @Nullable Object> uriVariables) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Create a new resource by POSTing the given object to the URI template, and return the value of theLocationheader. This header typically indicates where the new resource is stored.URI Template variables are expanded using the given map.
The
requestparameter can be aHttpEntityin order to add additional HTTP headers to the requestThe body of the entity, or
requestitself, can be aMultiValueMapto create a multipart request. The values in theMultiValueMapcan be any Object representing the body of the part, or anHttpEntityrepresenting a part with body and headers.- Parameters:
url- the URLrequest- the Object to be POSTed (may benull)uriVariables- the variables to expand the template- Returns:
- the value for the
Locationheader - Throws:
RestClientException- See Also:
-
postForLocation
Deprecated, for removal: This API element is subject to removal in a future version.Create a new resource by POSTing the given object to the URL, and return the value of theLocationheader. This header typically indicates where the new resource is stored.The
requestparameter can be aHttpEntityin order to add additional HTTP headers to the request.The body of the entity, or
requestitself, can be aMultiValueMapto create a multipart request. The values in theMultiValueMapcan be any Object representing the body of the part, or anHttpEntityrepresenting a part with body and headers.- Parameters:
url- the URLrequest- the Object to be POSTed (may benull)- Returns:
- the value for the
Locationheader - Throws:
RestClientException- See Also:
-
postForObject
<T> @Nullable T postForObject(String url, @Nullable Object request, Class<T> responseType, @Nullable Object... uriVariables) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Create a new resource by POSTing the given object to the URI template, and return the representation found in the response.URI Template variables are expanded using the given URI variables, if any.
The
requestparameter can be aHttpEntityin order to add additional HTTP headers to the request.The body of the entity, or
requestitself, can be aMultiValueMapto create a multipart request. The values in theMultiValueMapcan be any Object representing the body of the part, or anHttpEntityrepresenting a part with body and headers.- Parameters:
url- the URLrequest- the Object to be POSTed (may benull)responseType- the type of the return valueuriVariables- the variables to expand the template- Returns:
- the converted object
- Throws:
RestClientException- See Also:
-
postForObject
<T> @Nullable T postForObject(String url, @Nullable Object request, Class<T> responseType, Map<String, ? extends @Nullable Object> uriVariables) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Create a new resource by POSTing the given object to the URI template, and return the representation found in the response.URI Template variables are expanded using the given map.
The
requestparameter can be aHttpEntityin order to add additional HTTP headers to the request.The body of the entity, or
requestitself, can be aMultiValueMapto create a multipart request. The values in theMultiValueMapcan be any Object representing the body of the part, or anHttpEntityrepresenting a part with body and headers.- Parameters:
url- the URLrequest- the Object to be POSTed (may benull)responseType- the type of the return valueuriVariables- the variables to expand the template- Returns:
- the converted object
- Throws:
RestClientException- See Also:
-
postForObject
<T> @Nullable T postForObject(URI url, @Nullable Object request, Class<T> responseType) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Create a new resource by POSTing the given object to the URL, and return the representation found in the response.The
requestparameter can be aHttpEntityin order to add additional HTTP headers to the request.The body of the entity, or
requestitself, can be aMultiValueMapto create a multipart request. The values in theMultiValueMapcan be any Object representing the body of the part, or anHttpEntityrepresenting a part with body and headers.- Parameters:
url- the URLrequest- the Object to be POSTed (may benull)responseType- the type of the return value- Returns:
- the converted object
- Throws:
RestClientException- See Also:
-
postForEntity
<T> ResponseEntity<T> postForEntity(String url, @Nullable Object request, Class<T> responseType, @Nullable Object... uriVariables) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Create a new resource by POSTing the given object to the URI template, and return the response asResponseEntity.URI Template variables are expanded using the given URI variables, if any.
The
requestparameter can be aHttpEntityin order to add additional HTTP headers to the request.The body of the entity, or
requestitself, can be aMultiValueMapto create a multipart request. The values in theMultiValueMapcan be any Object representing the body of the part, or anHttpEntityrepresenting a part with body and headers.- Parameters:
url- the URLrequest- the Object to be POSTed (may benull)uriVariables- the variables to expand the template- Returns:
- the converted object
- Throws:
RestClientException- Since:
- 3.0.2
- See Also:
-
postForEntity
<T> ResponseEntity<T> postForEntity(String url, @Nullable Object request, Class<T> responseType, Map<String, ? extends @Nullable Object> uriVariables) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Create a new resource by POSTing the given object to the URI template, and return the response asHttpEntity.URI Template variables are expanded using the given map.
The
requestparameter can be aHttpEntityin order to add additional HTTP headers to the request.The body of the entity, or
requestitself, can be aMultiValueMapto create a multipart request. The values in theMultiValueMapcan be any Object representing the body of the part, or anHttpEntityrepresenting a part with body and headers.- Parameters:
url- the URLrequest- the Object to be POSTed (may benull)uriVariables- the variables to expand the template- Returns:
- the converted object
- Throws:
RestClientException- Since:
- 3.0.2
- See Also:
-
postForEntity
<T> ResponseEntity<T> postForEntity(URI url, @Nullable Object request, Class<T> responseType) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Create a new resource by POSTing the given object to the URL, and return the response asResponseEntity.The
requestparameter can be aHttpEntityin order to add additional HTTP headers to the request.The body of the entity, or
requestitself, can be aMultiValueMapto create a multipart request. The values in theMultiValueMapcan be any Object representing the body of the part, or anHttpEntityrepresenting a part with body and headers.- Parameters:
url- the URLrequest- the Object to be POSTed (may benull)- Returns:
- the converted object
- Throws:
RestClientException- Since:
- 3.0.2
- See Also:
-
put
void put(String url, @Nullable Object request, @Nullable Object... uriVariables) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.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
requestparameter can be aHttpEntityin order to add additional HTTP headers to the request.- Parameters:
url- the URLrequest- the Object to be PUT (may benull)uriVariables- the variables to expand the template- Throws:
RestClientException- See Also:
-
put
void put(String url, @Nullable Object request, Map<String, ? extends @Nullable Object> uriVariables) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Creates a new resource by PUTting the given object to URI template.URI Template variables are expanded using the given map.
The
requestparameter can be aHttpEntityin order to add additional HTTP headers to the request.- Parameters:
url- the URLrequest- the Object to be PUT (may benull)uriVariables- the variables to expand the template- Throws:
RestClientException- See Also:
-
put
Deprecated, for removal: This API element is subject to removal in a future version.Creates a new resource by PUTting the given object to URL.The
requestparameter can be aHttpEntityin order to add additional HTTP headers to the request.- Parameters:
url- the URLrequest- the Object to be PUT (may benull)- Throws:
RestClientException- See Also:
-
patchForObject
<T> @Nullable T patchForObject(String url, @Nullable Object request, Class<T> responseType, @Nullable Object... uriVariables) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Update a resource by PATCHing the given object to the URI template, and return the representation found in the response.URI Template variables are expanded using the given URI variables, if any.
The
requestparameter can be aHttpEntityin order to add additional HTTP headers to the request.NOTE: The standard JDK HTTP library does not support HTTP PATCH. You need to use, for example, the Apache HttpComponents request factory.
- Parameters:
url- the URLrequest- the object to be PATCHed (may benull)responseType- the type of the return valueuriVariables- the variables to expand the template- Returns:
- the converted object
- Throws:
RestClientException- Since:
- 4.3.5
- See Also:
-
patchForObject
<T> @Nullable T patchForObject(String url, @Nullable Object request, Class<T> responseType, Map<String, ? extends @Nullable Object> uriVariables) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Update a resource by PATCHing the given object to the URI template, and return the representation found in the response.URI Template variables are expanded using the given map.
The
requestparameter can be aHttpEntityin order to add additional HTTP headers to the request.NOTE: The standard JDK HTTP library does not support HTTP PATCH. You need to use, for example, the Apache HttpComponents request factory.
- Parameters:
url- the URLrequest- the object to be PATCHed (may benull)responseType- the type of the return valueuriVariables- the variables to expand the template- Returns:
- the converted object
- Throws:
RestClientException- Since:
- 4.3.5
- See Also:
-
patchForObject
<T> @Nullable T patchForObject(URI url, @Nullable Object request, Class<T> responseType) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Update a resource by PATCHing the given object to the URL, and return the representation found in the response.The
requestparameter can be aHttpEntityin order to add additional HTTP headers to the request.NOTE: The standard JDK HTTP library does not support HTTP PATCH. You need to use, for example, the Apache HttpComponents request factory.
- Parameters:
url- the URLrequest- the object to be PATCHed (may benull)responseType- the type of the return value- Returns:
- the converted object
- Throws:
RestClientException- Since:
- 4.3.5
- See Also:
-
delete
Deprecated, for removal: This API element is subject to removal in a future version.Delete the resources at the specified URI.URI Template variables are expanded using the given URI variables, if any.
- Parameters:
url- the URLuriVariables- the variables to expand in the template- Throws:
RestClientException
-
delete
void delete(String url, Map<String, ? extends @Nullable Object> uriVariables) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Delete the resources at the specified URI.URI Template variables are expanded using the given map.
- Parameters:
url- the URLuriVariables- the variables to expand the template- Throws:
RestClientException
-
delete
Deprecated, for removal: This API element is subject to removal in a future version.Delete the resources at the specified URL.- Parameters:
url- the URL- Throws:
RestClientException
-
optionsForAllow
Set<HttpMethod> optionsForAllow(String url, @Nullable Object... uriVariables) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Return the value of theAllowheader for the given URI.URI Template variables are expanded using the given URI variables, if any.
- Parameters:
url- the URLuriVariables- the variables to expand in the template- Returns:
- the value of the
Allowheader - Throws:
RestClientException
-
optionsForAllow
Set<HttpMethod> optionsForAllow(String url, Map<String, ? extends @Nullable Object> uriVariables) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Return the value of theAllowheader for the given URI.URI Template variables are expanded using the given map.
- Parameters:
url- the URLuriVariables- the variables to expand in the template- Returns:
- the value of the
Allowheader - Throws:
RestClientException
-
optionsForAllow
Deprecated, for removal: This API element is subject to removal in a future version.Return the value of theAllowheader for the given URL.- Parameters:
url- the URL- Returns:
- the value of the
Allowheader - Throws:
RestClientException
-
exchange
<T> ResponseEntity<T> exchange(String url, HttpMethod method, @Nullable HttpEntity<?> requestEntity, Class<T> responseType, @Nullable Object... uriVariables) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Execute the HTTP method to the given URI template, writing the given request entity to the request, and return the response asResponseEntity.URI Template variables are expanded using the given URI variables, if any.
- 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 to convert the response to, orVoid.classfor no bodyuriVariables- the variables to expand in the template- Returns:
- the response as entity
- Throws:
RestClientException- Since:
- 3.0.2
-
exchange
<T> ResponseEntity<T> exchange(String url, HttpMethod method, @Nullable HttpEntity<?> requestEntity, Class<T> responseType, Map<String, ? extends @Nullable Object> uriVariables) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Execute the HTTP method to the given URI template, writing the given request entity to the request, and return the response asResponseEntity.URI Template variables are expanded using the given URI variables, if any.
- 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 to convert the response to, orVoid.classfor no bodyuriVariables- the variables to expand in the template- Returns:
- the response as entity
- Throws:
RestClientException- Since:
- 3.0.2
-
exchange
<T> ResponseEntity<T> exchange(URI url, HttpMethod method, @Nullable HttpEntity<?> requestEntity, Class<T> responseType) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Execute the HTTP method to the given URI template, writing the given request entity to the request, and return the response asResponseEntity.- 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 to convert the response to, orVoid.classfor no body- Returns:
- the response as entity
- Throws:
RestClientException- Since:
- 3.0.2
-
exchange
<T> ResponseEntity<T> exchange(String url, HttpMethod method, @Nullable HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType, @Nullable Object... uriVariables) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Execute the HTTP method to the given URI template, writing the given request entity to the request, and return the response asResponseEntity. The givenParameterizedTypeReferenceis 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);- 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 to convert the response to, orVoid.classfor no bodyuriVariables- the variables to expand in the template- Returns:
- the response as entity
- Throws:
RestClientException- Since:
- 3.2
-
exchange
<T> ResponseEntity<T> exchange(String url, HttpMethod method, @Nullable HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType, Map<String, ? extends @Nullable Object> uriVariables) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Execute the HTTP method to the given URI template, writing the given request entity to the request, and return the response asResponseEntity. The givenParameterizedTypeReferenceis 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);- 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 to convert the response to, orVoid.classfor no bodyuriVariables- the variables to expand in the template- Returns:
- the response as entity
- Throws:
RestClientException- Since:
- 3.2
-
exchange
<T> ResponseEntity<T> exchange(URI url, HttpMethod method, @Nullable HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Execute the HTTP method to the given URI template, writing the given request entity to the request, and return the response asResponseEntity. The givenParameterizedTypeReferenceis 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);- 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 to convert the response to, orVoid.classfor no body- Returns:
- the response as entity
- Throws:
RestClientException- Since:
- 3.2
-
exchange
<T> ResponseEntity<T> exchange(RequestEntity<?> requestEntity, Class<T> responseType) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Execute the request specified in the givenRequestEntityand return the response asResponseEntity. Typically used in combination with the static builder methods onRequestEntity, for instance:MyRequest body = ... RequestEntity request = RequestEntity .post(URI.create("https://example.com/foo")) .accept(MediaType.APPLICATION_JSON) .body(body); ResponseEntity<MyResponse> response = template.exchange(request, MyResponse.class);- Parameters:
requestEntity- the entity to write to the requestresponseType- the type to convert the response to, orVoid.classfor no body- Returns:
- the response as entity
- Throws:
RestClientException- Since:
- 4.1
-
exchange
<T> ResponseEntity<T> exchange(RequestEntity<?> requestEntity, ParameterizedTypeReference<T> responseType) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Execute the request specified in the givenRequestEntityand return the response asResponseEntity. The givenParameterizedTypeReferenceis used to pass generic type information:MyRequest body = ... RequestEntity request = RequestEntity .post(URI.create("https://example.com/foo")) .accept(MediaType.APPLICATION_JSON) .body(body); ParameterizedTypeReference<List<MyResponse>> myBean = new ParameterizedTypeReference<List<MyResponse>>() {}; ResponseEntity<List<MyResponse>> response = template.exchange(request, myBean);- Parameters:
requestEntity- the entity to write to the requestresponseType- the type to convert the response to, orVoid.classfor no body- Returns:
- the response as entity
- Throws:
RestClientException- Since:
- 4.1
-
execute
<T> @Nullable T execute(String uriTemplate, HttpMethod method, @Nullable RequestCallback requestCallback, @Nullable ResponseExtractor<T> responseExtractor, @Nullable Object... uriVariables) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Execute the HTTP method to the given URI template, preparing the request with theRequestCallback, and reading the response with aResponseExtractor.URI Template variables are expanded using the given URI variables, if any.
- Parameters:
uriTemplate- the URI templatemethod- 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
<T> @Nullable T execute(String uriTemplate, HttpMethod method, @Nullable RequestCallback requestCallback, @Nullable ResponseExtractor<T> responseExtractor, Map<String, ? extends @Nullable Object> uriVariables) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Execute the HTTP method to the given URI template, preparing the request with theRequestCallback, and reading the response with aResponseExtractor.URI Template variables are expanded using the given URI variables map.
- Parameters:
uriTemplate- the URI templatemethod- 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
<T> @Nullable T execute(URI url, HttpMethod method, @Nullable RequestCallback requestCallback, @Nullable ResponseExtractor<T> responseExtractor) throws RestClientException Deprecated, for removal: This API element is subject to removal in a future version.Execute the HTTP method to the given URL, preparing the request with theRequestCallback, and reading the response with aResponseExtractor.- 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
-
RestClient.