polishing
This commit is contained in:
parent
aa36118e1c
commit
823cc6e691
|
|
@ -66,9 +66,9 @@
|
||||||
URI Template in order to extract a collection of variables.</para>
|
URI Template in order to extract a collection of variables.</para>
|
||||||
|
|
||||||
<para>Spring uses the <classname>@RequestMapping</classname> method
|
<para>Spring uses the <classname>@RequestMapping</classname> method
|
||||||
annotation to define the URI Template for the request.
|
annotation to define the URI Template for the request. The
|
||||||
The<classname>@PathVariable</classname> annotation is used to extract
|
<classname>@PathVariable</classname> annotation is used to extract the
|
||||||
the value of the template variables and assign their value to a method
|
value of the template variables and assign their value to a method
|
||||||
variable. A Spring controller method to process above example is shown
|
variable. A Spring controller method to process above example is shown
|
||||||
below;</para>
|
below;</para>
|
||||||
|
|
||||||
|
|
@ -239,9 +239,11 @@ public void handle(@RequestBody String body, Writer writer) throws IOException {
|
||||||
</property
|
</property
|
||||||
</bean>
|
</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="marshaller" ref="castorMarshaller" />
|
||||||
<property name="unmarshaller" ref="castorMarshaller" />
|
<property name="unmarshaller" ref="castorMarshaller" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
@ -447,13 +449,15 @@ public class ContentController {
|
||||||
<programlisting language="java">public class SampleContentAtomView extends AbstractAtomFeedView {
|
<programlisting language="java">public class SampleContentAtomView extends AbstractAtomFeedView {
|
||||||
|
|
||||||
@Override
|
@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
|
// implementation omitted
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<Entry> buildFeedEntries(Map<String, Object> model,
|
protected List<Entry> buildFeedEntries(Map<String, Object> model,
|
||||||
HttpServletRequest request, HttpServletResponse response) throws Exception {
|
HttpServletRequest request,
|
||||||
|
HttpServletResponse response) throws Exception {
|
||||||
|
|
||||||
// implementation omitted
|
// implementation omitted
|
||||||
}
|
}
|
||||||
|
|
@ -465,13 +469,15 @@ public class ContentController {
|
||||||
<programlisting language="java">public class SampleContentAtomView extends AbstractRssFeedView {
|
<programlisting language="java">public class SampleContentAtomView extends AbstractRssFeedView {
|
||||||
|
|
||||||
@Override
|
@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
|
// implementation omitted
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<Item> buildFeedItems(Map<String, Object> model,
|
protected List<Item> buildFeedItems(Map<String, Object> model,
|
||||||
HttpServletRequest request, HttpServletResponse response) throws Exception {
|
HttpServletRequest request,
|
||||||
|
HttpServletResponse response) throws Exception {
|
||||||
// implementation omitted
|
// implementation omitted
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -781,7 +787,8 @@ if (HttpStatus.SC_CREATED == post.getStatusCode()) {
|
||||||
<para>using variable length arguments and </para>
|
<para>using variable length arguments and </para>
|
||||||
|
|
||||||
<programlisting language="java">Map<String, String> vars = Collections.singletonMap("hotel", 42);
|
<programlisting language="java">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);
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
<para>using a <literal>Map<String,String></literal>. </para>
|
<para>using a <literal>Map<String,String></literal>. </para>
|
||||||
|
|
@ -858,10 +865,12 @@ URI location = template.postForLocation(uri, booking, String.class, "1");
|
||||||
List<MediaType> getSupportedMediaTypes();
|
List<MediaType> getSupportedMediaTypes();
|
||||||
|
|
||||||
// Read an object of the given type form the given input message, and returns it.
|
// 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.
|
// 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;
|
||||||
|
|
||||||
}</programlisting>
|
}</programlisting>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue