Top Description Methods
org.springframework.web.client

public Interface RestOperations

Known Direct Implementers
org.springframework.web.client.RestTemplate
Imports
java.net.URI, java.util.Map, .Set, org.springframework.core.ParameterizedTypeReference, org.springframework.http.HttpEntity, .HttpHeaders, .HttpMethod, .RequestEntity, .ResponseEntity, org.springframework.lang.Nullable

Interface specifying a basic set of RESTful operations.

Implemented by RestTemplate. Not often used directly, but a useful option to enhance testability, as it can easily be mocked or stubbed.

Authors
Arjen Poutsma, Juergen Hoeller
Since
3.0
See Also
RestTemplate

Method Summary

Modifier and TypeMethod and Description
public void
delete(String
the URL
url
,
Object...
the variables to expand in the template
uriVariables
)

Delete the resources at the specified URI.

public void
delete(String
the URL
url
,
Map<String, ?>
the variables to expand the template
uriVariables
)

Delete the resources at the specified URI.

public void
delete(URI
the URL
url
)

Delete the resources at the specified URL.

public <T> ResponseEntity<T>

Returns:

the response as entity
exchange
(String
the URL
url
,
HttpMethod
the HTTP method (GET, POST, etc)
method
,
HttpEntity<?>
the entity (headers and/or body) to write to the request may be null)
requestEntity
,
Class<T>
the type to convert the response to, or Void.class for no body
responseType
,
Object...
the variables to expand in the template
uriVariables
)

Execute the HTTP method to the given URI template, writing the given request entity to the request, and return the response as ResponseEntity.

public <T> ResponseEntity<T>

Returns:

the response as entity
exchange
(String
the URL
url
,
HttpMethod
the HTTP method (GET, POST, etc)
method
,
HttpEntity<?>
the entity (headers and/or body) to write to the request (may be null)
requestEntity
,
Class<T>
the type to convert the response to, or Void.class for no body
responseType
,
Map<String, ?>
the variables to expand in the template
uriVariables
)

Execute the HTTP method to the given URI template, writing the given request entity to the request, and return the response as ResponseEntity.

public <T> ResponseEntity<T>

Returns:

the response as entity
exchange
(URI
the URL
url
,
HttpMethod
the HTTP method (GET, POST, etc)
method
,
HttpEntity<?>
the entity (headers and/or body) to write to the request (may be null)
requestEntity
,
Class<T>
the type to convert the response to, or Void.class for no body
responseType
)

Execute the HTTP method to the given URI template, writing the given request entity to the request, and return the response as ResponseEntity.

public <T> ResponseEntity<T>

Returns:

the response as entity
exchange
(String
the URL
url
,
HttpMethod
the HTTP method (GET, POST, etc)
method
,
HttpEntity<?>
the entity (headers and/or body) to write to the request (may be null)
requestEntity
,
ParameterizedTypeReference<T>
the type to convert the response to, or Void.class for no body
responseType
,
Object...
the variables to expand in the template
uriVariables
)

Execute the HTTP method to the given URI template, writing the given request entity to the request, and return the response as ResponseEntity.

public <T> ResponseEntity<T>

Returns:

the response as entity
exchange
(String
the URL
url
,
HttpMethod
the HTTP method (GET, POST, etc)
method
,
HttpEntity<?>
the entity (headers and/or body) to write to the request (may be null)
requestEntity
,
ParameterizedTypeReference<T>
the type to convert the response to, or Void.class for no body
responseType
,
Map<String, ?>
the variables to expand in the template
uriVariables
)

Execute the HTTP method to the given URI template, writing the given request entity to the request, and return the response as ResponseEntity.

public <T> ResponseEntity<T>

Returns:

the response as entity
exchange
(URI
the URL
url
,
HttpMethod
the HTTP method (GET, POST, etc)
method
,
HttpEntity<?>
the entity (headers and/or body) to write to the request (may be null)
requestEntity
,
ParameterizedTypeReference<T>
the type to convert the response to, or Void.class for no body
responseType
)

Execute the HTTP method to the given URI template, writing the given request entity to the request, and return the response as ResponseEntity.

public <T> ResponseEntity<T>

Returns:

the response as entity
exchange
(RequestEntity<?>
the entity to write to the request
requestEntity
,
Class<T>
the type to convert the response to, or Void.class for no body
responseType
)

Execute the request specified in the given RequestEntity and return the response as ResponseEntity.

public <T> ResponseEntity<T>

Returns:

the response as entity
exchange
(RequestEntity<?>
the entity to write to the request
requestEntity
,
ParameterizedTypeReference<T>
the type to convert the response to, or Void.class for no body
responseType
)

Execute the request specified in the given RequestEntity and return the response as ResponseEntity.

public <T> T

Returns:

an arbitrary object, as returned by the ResponseExtractor
execute
(String
the URI template
uriTemplate
,
HttpMethod
the HTTP method (GET, POST, etc)
method
,
RequestCallback
object that prepares the request
requestCallback
,
ResponseExtractor<T>
object that extracts the return value from the response
responseExtractor
,
Object...
the variables to expand in the template
uriVariables
)

Execute the HTTP method to the given URI template, preparing the request with the RequestCallback, and reading the response with a ResponseExtractor.

public <T> T

Returns:

an arbitrary object, as returned by the ResponseExtractor
execute
(String
the URI template
uriTemplate
,
HttpMethod
the HTTP method (GET, POST, etc)
method
,
RequestCallback
object that prepares the request
requestCallback
,
ResponseExtractor<T>
object that extracts the return value from the response
responseExtractor
,
Map<String, ?>
the variables to expand in the template
uriVariables
)

Execute the HTTP method to the given URI template, preparing the request with the RequestCallback, and reading the response with a ResponseExtractor.

public <T> T

Returns:

an arbitrary object, as returned by the ResponseExtractor
execute
(URI
the URL
url
,
HttpMethod
the HTTP method (GET, POST, etc)
method
,
RequestCallback
object that prepares the request
requestCallback
,
ResponseExtractor<T>
object that extracts the return value from the response
responseExtractor
)

Execute the HTTP method to the given URL, preparing the request with the RequestCallback, and reading the response with a ResponseExtractor.

public <T> ResponseEntity<T>

Returns:

the entity
getForEntity
(String
the URL
url
,
Class<T>
the type of the return value
responseType
,
Object...
the variables to expand the template
uriVariables
)

Retrieve an entity by doing a GET on the specified URL.

public <T> ResponseEntity<T>

Returns:

the converted object
getForEntity
(String
the URL
url
,
Class<T>
the type of the return value
responseType
,
Map<String, ?>
the map containing variables for the URI template
uriVariables
)

Retrieve a representation by doing a GET on the URI template.

public <T> ResponseEntity<T>

Returns:

the converted object
getForEntity
(URI
the URL
url
,
Class<T>
the type of the return value
responseType
)

Retrieve a representation by doing a GET on the URL.

public <T> T

Returns:

the converted object
getForObject
(String
the URL
url
,
Class<T>
the type of the return value
responseType
,
Object...
the variables to expand the template
uriVariables
)

Retrieve a representation by doing a GET on the specified URL.

public <T> T

Returns:

the converted object
getForObject
(String
the URL
url
,
Class<T>
the type of the return value
responseType
,
Map<String, ?>
the map containing variables for the URI template
uriVariables
)

Retrieve a representation by doing a GET on the URI template.

public <T> T

Returns:

the converted object
getForObject
(URI
the URL
url
,
Class<T>
the type of the return value
responseType
)

Retrieve a representation by doing a GET on the URL.

public HttpHeaders

Returns:

all HTTP headers of that resource
headForHeaders
(String
the URL
url
,
Object...
the variables to expand the template
uriVariables
)

Retrieve all headers of the resource specified by the URI template.

public HttpHeaders

Returns:

all HTTP headers of that resource
headForHeaders
(String
the URL
url
,
Map<String, ?>
the map containing variables for the URI template
uriVariables
)

Retrieve all headers of the resource specified by the URI template.

public HttpHeaders

Returns:

all HTTP headers of that resource
headForHeaders
(URI
the URL
url
)

Retrieve all headers of the resource specified by the URL.

public Set<HttpMethod>

Returns:

the value of the Allow header
optionsForAllow
(String
the URL
url
,
Object...
the variables to expand in the template
uriVariables
)

Return the value of the Allow header for the given URI.

public Set<HttpMethod>

Returns:

the value of the Allow header
optionsForAllow
(String
the URL
url
,
Map<String, ?>
the variables to expand in the template
uriVariables
)

Return the value of the Allow header for the given URI.

public Set<HttpMethod>

Returns:

the value of the Allow header
optionsForAllow
(URI
the URL
url
)

Return the value of the Allow header for the given URL.

public <T> T

Returns:

the converted object
patchForObject
(String
the URL
url
,
Object
the object to be PATCHed (may be null)
request
,
Class<T>
the type of the return value
responseType
,
Object...
the variables to expand the template
uriVariables
)

Update a resource by PATCHing the given object to the URI template, and return the representation found in the response.

public <T> T

Returns:

the converted object
patchForObject
(String
the URL
url
,
Object
the object to be PATCHed (may be null)
request
,
Class<T>
the type of the return value
responseType
,
Map<String, ?>
the variables to expand the template
uriVariables
)

Update a resource by PATCHing the given object to the URI template, and return the representation found in the response.

public <T> T

Returns:

the converted object
patchForObject
(URI
the URL
url
,
Object
the object to be PATCHed (may be null)
request
,
Class<T>
the type of the return value
responseType
)

Update a resource by PATCHing the given object to the URL, and return the representation found in the response.

public <T> ResponseEntity<T>

Returns:

the converted object
postForEntity
(String
the URL
url
,
Object
the Object to be POSTed (may be null)
request
,
Class<T> responseType, Object...
the variables to expand the template
uriVariables
)

Create a new resource by POSTing the given object to the URI template, and return the response as ResponseEntity.

public <T> ResponseEntity<T>

Returns:

the converted object
postForEntity
(String
the URL
url
,
Object
the Object to be POSTed (may be null)
request
,
Class<T> responseType, Map<String, ?>
the variables to expand the template
uriVariables
)

Create a new resource by POSTing the given object to the URI template, and return the response as HttpEntity.

public <T> ResponseEntity<T>

Returns:

the converted object
postForEntity
(URI
the URL
url
,
Object
the Object to be POSTed (may be null)
request
,
Class<T> responseType)

Create a new resource by POSTing the given object to the URL, and return the response as ResponseEntity.

public URI

Returns:

the value for the Location header
postForLocation
(String
the URL
url
,
Object
the Object to be POSTed (may be null)
request
,
Object...
the variables to expand the template
uriVariables
)

Create a new resource by POSTing the given object to the URI template, and return the value of the Location header.

public URI

Returns:

the value for the Location header
postForLocation
(String
the URL
url
,
Object
the Object to be POSTed (may be null)
request
,
Map<String, ?>
the variables to expand the template
uriVariables
)

Create a new resource by POSTing the given object to the URI template, and return the value of the Location header.

public URI

Returns:

the value for the Location header
postForLocation
(URI
the URL
url
,
Object
the Object to be POSTed (may be null)
request
)

Create a new resource by POSTing the given object to the URL, and return the value of the Location header.

public <T> T

Returns:

the converted object
postForObject
(String
the URL
url
,
Object
the Object to be POSTed (may be null)
request
,
Class<T>
the type of the return value
responseType
,
Object...
the variables to expand the template
uriVariables
)

Create a new resource by POSTing the given object to the URI template, and return the representation found in the response.

public <T> T

Returns:

the converted object
postForObject
(String
the URL
url
,
Object
the Object to be POSTed (may be null)
request
,
Class<T>
the type of the return value
responseType
,
Map<String, ?>
the variables to expand the template
uriVariables
)

Create a new resource by POSTing the given object to the URI template, and return the representation found in the response.

public <T> T

Returns:

the converted object
postForObject
(URI
the URL
url
,
Object
the Object to be POSTed (may be null)
request
,
Class<T>
the type of the return value
responseType
)

Create a new resource by POSTing the given object to the URL, and return the representation found in the response.

public void
put(String
the URL
url
,
Object
the Object to be PUT (may be null)
request
,
Object...
the variables to expand the template
uriVariables
)

Create or update a resource by PUTting the given object to the URI.

public void
put(String
the URL
url
,
Object
the Object to be PUT (may be null)
request
,
Map<String, ?>
the variables to expand the template
uriVariables
)

Creates a new resource by PUTting the given object to URI template.

public void
put(URI
the URL
url
,
Object
the Object to be PUT (may be null)
request
)

Creates a new resource by PUTting the given object to URL.