diff --git a/spring-framework-reference/src/remoting.xml b/spring-framework-reference/src/remoting.xml
index 3d5aee275f2..e3433f6cc64 100644
--- a/spring-framework-reference/src/remoting.xml
+++ b/spring-framework-reference/src/remoting.xml
@@ -1331,24 +1331,28 @@ if (HttpStatus.SC_CREATED == post.getStatusCode()) {
DELETE
delete(String
- url, String… urlVariables)
+ url="http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/web/client/RestTemplate.html#delete(String,%20Object...)">delete
GET
getForObject(String
- url, Class<T> responseType, String…
- urlVariables)
+ url="http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/web/client/RestTemplate.html#getForObject(String,%20Class,%20Object...)">getForObject
+
+
+
+
+
+ getForEntity
HEAD
headForHeaders(String
+ url="http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/web/client/RestTemplate.html#headForHeaders(String,%20Object...)">headForHeaders(String
url, String… urlVariables)
@@ -1356,7 +1360,7 @@ if (HttpStatus.SC_CREATED == post.getStatusCode()) {
OPTIONS
optionsForAllow(String
+ url="http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/web/client/RestTemplate.html#optionsForAllow(String,%20Object...)">optionsForAllow(String
url, String… urlVariables)
@@ -1364,7 +1368,7 @@ if (HttpStatus.SC_CREATED == post.getStatusCode()) {
POST
postForLocation(String
+ url="http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/web/client/RestTemplate.html#postForLocation(String,%20Object,%20Object...)">postForLocation(String
url, Object request, String… urlVariables)
@@ -1381,7 +1385,7 @@ if (HttpStatus.SC_CREATED == post.getStatusCode()) {
PUT
put(String
+ url="http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/web/client/RestTemplate.html#put(String,%20Object,%20Object...)">put(String
url, Object request, String…urlVariables)
@@ -1486,6 +1490,33 @@ URI location = template.postForLocation(uri, booking, "1");
request and handle any errors. Refer to the API documentation for more
information on using the execute method and the meaning of its other
method arguments.
+
+
+ Dealing with request and response headers
+
+ Besides the methods described above, the RestTemplate
+ also has the exchange method, which can be
+ used for arbitrary HTTP method execution based on the HttpEntity
+ class.
+
+ Perhaps most importantly, the execute
+ method can be used to add request headers and read response headers.
+ For example:
+
+ HttpHeaders requestHeaders = new HttpHeaders();
+requestHeaders.set("MyRequestHeader", "MyValue");
+HttpEntity<?> requestEntity = new HttpEntity(requestHeaders);
+
+HttpEntity<String> response = template.exchange("http://example.com/hotels/{hotel}",
+ HttpMethod.GET, requestEntity, String.class, "42");
+
+String responseHeader = response.getHeaders().getFirst("MyResponseHeader");
+String body = response.getBody();
+
+ In the above example, we first prepare a request entity that contains the
+ MyRequestHeader header. We then retrieve the response, and
+ read the MyResponseHeader and body.
+
@@ -1501,8 +1532,11 @@ URI location = template.postForLocation(uri, booking, "1");
public interface HttpMessageConverter<T> {
- // Indicate whether the given class is supported by this converter.
- boolean supports(Class<? extends T> clazz);
+ // Indicate whether the given class and media type can be read by this converter.
+ boolean canRead(Class<?> clazz, MediaType mediaType);
+
+ // Indicate whether the given class and media type can be written by this converter.
+ boolean canWrite(Class<?> clazz, MediaType mediaType);
// Return the list of MediaType objects supported by this converter.
List<MediaType> getSupportedMediaTypes();