From 823cc6e691375541e6db0bba812cc0e8611d86c7 Mon Sep 17 00:00:00 2001 From: Mark Pollack Date: Tue, 14 Apr 2009 07:07:01 +0000 Subject: [PATCH] polishing --- spring-framework-reference/src/rest.xml | 33 ++++++++++++++++--------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/spring-framework-reference/src/rest.xml b/spring-framework-reference/src/rest.xml index d2b88dabd6..6b176bbb19 100644 --- a/spring-framework-reference/src/rest.xml +++ b/spring-framework-reference/src/rest.xml @@ -66,9 +66,9 @@ URI Template in order to extract a collection of variables. Spring uses the @RequestMapping method - annotation to define the URI Template for the request. - The@PathVariable annotation is used to extract - the value of the template variables and assign their value to a method + annotation to define the URI Template for the request. The + @PathVariable annotation is used to extract the + value of the template variables and assign their value to a method variable. A Spring controller method to process above example is shown below; @@ -239,9 +239,11 @@ public void handle(@RequestBody String body, Writer writer) throws IOException { </property </bean> -<bean id="stringHttpMessageConverter" class="org.springframework.http.converter.StringHttpMessageConverter"/> +<bean id="stringHttpMessageConverter" + class="org.springframework.http.converter.StringHttpMessageConverter"/> -<bean id="marshallingHttpMessageConverter" class="org.springframework.http.converter.xml.MarshallingHttpMessageConverter"> +<bean id="marshallingHttpMessageConverter" + class="org.springframework.http.converter.xml.MarshallingHttpMessageConverter"> <property name="marshaller" ref="castorMarshaller" /> <property name="unmarshaller" ref="castorMarshaller" /> </bean> @@ -447,13 +449,15 @@ public class ContentController { public class SampleContentAtomView extends AbstractAtomFeedView { @Override - protected void buildFeedMetadata(Map<String, Object> model, Feed feed, HttpServletRequest request) { + protected void buildFeedMetadata(Map<String, Object> model, Feed feed, + HttpServletRequest request) { // implementation omitted } @Override protected List<Entry> buildFeedEntries(Map<String, Object> model, - HttpServletRequest request, HttpServletResponse response) throws Exception { + HttpServletRequest request, + HttpServletResponse response) throws Exception { // implementation omitted } @@ -465,13 +469,15 @@ public class ContentController { public class SampleContentAtomView extends AbstractRssFeedView { @Override - protected void buildFeedMetadata(Map<String, Object> model, Channel feed, HttpServletRequest request) { + protected void buildFeedMetadata(Map<String, Object> model, Channel feed, + HttpServletRequest request) { // implementation omitted } @Override protected List<Item> buildFeedItems(Map<String, Object> model, - HttpServletRequest request, HttpServletResponse response) throws Exception { + HttpServletRequest request, + HttpServletResponse response) throws Exception { // implementation omitted } @@ -781,7 +787,8 @@ if (HttpStatus.SC_CREATED == post.getStatusCode()) { using variable length arguments and Map<String, String> vars = Collections.singletonMap("hotel", 42); -String result = restTemplate.getForObject("http://example.com/hotels/{hotel}/rooms/{hotel}", String.class, vars); +String result = + restTemplate.getForObject("http://example.com/hotels/{hotel}/rooms/{hotel}", String.class, vars); using a Map<String,String>. @@ -858,10 +865,12 @@ URI location = template.postForLocation(uri, booking, String.class, "1"); List<MediaType> getSupportedMediaTypes(); // Read an object of the given type form the given input message, and returns it. - T read(Class<T> clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException; + T read(Class<T> clazz, HttpInputMessage inputMessage) throws IOException, + HttpMessageNotReadableException; // Write an given object to the given output message. - void write(T t, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException; + void write(T t, HttpOutputMessage outputMessage) throws IOException, + HttpMessageNotWritableException; }