From 54ffedce0dc0d8afd6f4da99d08bed16bb183416 Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Fri, 19 Jun 2009 12:30:57 +0000 Subject: [PATCH] Documentation --- .../springframework/web/client/RestOperations.java | 4 ++-- .../springframework/web/client/RestTemplate.java | 10 +++++++--- spring-framework-reference/src/remoting.xml | 14 ++++++++++++-- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/org.springframework.web/src/main/java/org/springframework/web/client/RestOperations.java b/org.springframework.web/src/main/java/org/springframework/web/client/RestOperations.java index 001bb1adfe9..b67ffca9ac6 100644 --- a/org.springframework.web/src/main/java/org/springframework/web/client/RestOperations.java +++ b/org.springframework.web/src/main/java/org/springframework/web/client/RestOperations.java @@ -105,7 +105,7 @@ public interface RestOperations { URI postForLocation(String url, Object request, Map uriVariables) throws RestClientException; /** - * Create a new resource by POSTing the given object to the URI template, and returns the converted representation + * Create a new resource by POSTing the given object to the URI template, and returns the representation * found in the response.

URI Template variables are expanded using the given URI variables, if any. * * @param url the URL @@ -116,7 +116,7 @@ public interface RestOperations { throws RestClientException; /** - * Create a new resource by POSTing the given object to the URI template, and returns the converted representation + * Create a new resource by POSTing the given object to the URI template, and returns the representation * found in the response.

URI Template variables are expanded using the given map. * * @param url the URL diff --git a/org.springframework.web/src/main/java/org/springframework/web/client/RestTemplate.java b/org.springframework.web/src/main/java/org/springframework/web/client/RestTemplate.java index 33d38a6d09c..683bcad3fc9 100644 --- a/org.springframework.web/src/main/java/org/springframework/web/client/RestTemplate.java +++ b/org.springframework.web/src/main/java/org/springframework/web/client/RestTemplate.java @@ -45,10 +45,14 @@ import org.springframework.web.util.UriTemplate; * enforces RESTful principles. It handles HTTP connections, leaving application code to provide URLs (with possible * template variables) and extract results. * - *

The main entry points of this template are the methods named after the six main HTTP methods:
HTTP + *

The main entry points of this template are the methods named after the six main HTTP methods: + * - * - * + * + * + * + * + * *
HTTP * methodRestTemplate methods
DELETE{@link #delete}
GET{@link #getForObject}
HEAD{@link #headForHeaders}
OPTIONS{@link #optionsForAllow}
POST{@link #postForLocation}
GET{@link #getForObject}
HEAD{@link #headForHeaders}
OPTIONS{@link #optionsForAllow}
POST{@link #postForLocation}
{@link #postForObject}
PUT{@link #put}
any{@link #execute}
* *

Each of these methods takes {@linkplain UriTemplate uri template} arguments in two forms: as a {@code String} diff --git a/spring-framework-reference/src/remoting.xml b/spring-framework-reference/src/remoting.xml index bfb70195c04..f58bf98eaa5 100644 --- a/spring-framework-reference/src/remoting.xml +++ b/spring-framework-reference/src/remoting.xml @@ -1368,6 +1368,15 @@ if (HttpStatus.SC_CREATED == post.getStatusCode()) { url, Object request, String… urlVariables) + + + + postForObject(String + url, Object request, Class<T> responseType, String… + uriVariables) + + PUT @@ -1387,9 +1396,10 @@ if (HttpStatus.SC_CREATED == post.getStatusCode()) { object. The method postForLocation will do a POST, converting the given object into a HTTP request and return the response HTTP Location header where the newly created object can be - found In case of an exception processing the HTTP request, an exception + found. In case of an exception processing the HTTP request, an exception of the type RestClientException will be - thrown. + thrown, this behavior can be changed by plugging in another ResponseErrorHandler + implementation into the RestTemplate. Objects passed to and returned from these methods are converted to and from HTTP messages by