|
|
|
|
@ -230,26 +230,26 @@ public class RelativePathUriTemplateController {
@@ -230,26 +230,26 @@ public class RelativePathUriTemplateController {
|
|
|
|
|
<para>Here is an example configuration of a |
|
|
|
|
<classname>ContentNegotiatingViewResolver</classname></para> |
|
|
|
|
|
|
|
|
|
<programlisting language="xml"> <bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"> |
|
|
|
|
<property name="mediaTypes"> |
|
|
|
|
<map> |
|
|
|
|
<entry key="atom" value="application/atom+xml"/> |
|
|
|
|
<entry key="html" value="text/html"/> |
|
|
|
|
</map> |
|
|
|
|
</property> |
|
|
|
|
<property name="viewResolvers"> |
|
|
|
|
<list> |
|
|
|
|
<bean class="org.springframework.web.servlet.view.BeanNameViewResolver"/> |
|
|
|
|
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> |
|
|
|
|
<property name="prefix" value="/WEB-INF/jsp/"/> |
|
|
|
|
<property name="suffix" value=".jsp"/> |
|
|
|
|
</bean> |
|
|
|
|
</list> |
|
|
|
|
</property> |
|
|
|
|
</bean> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<bean id="content" class="com.springsource.samples.rest.SampleContentAtomView"/></programlisting> |
|
|
|
|
<programlisting language="xml"> <bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"> |
|
|
|
|
<property name="mediaTypes"> |
|
|
|
|
<map> |
|
|
|
|
<entry key="atom" value="application/atom+xml"/> |
|
|
|
|
<entry key="html" value="text/html"/> |
|
|
|
|
</map> |
|
|
|
|
</property> |
|
|
|
|
<property name="viewResolvers"> |
|
|
|
|
<list> |
|
|
|
|
<bean class="org.springframework.web.servlet.view.BeanNameViewResolver"/> |
|
|
|
|
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> |
|
|
|
|
<property name="prefix" value="/WEB-INF/jsp/"/> |
|
|
|
|
<property name="suffix" value=".jsp"/> |
|
|
|
|
</bean> |
|
|
|
|
</list> |
|
|
|
|
</property> |
|
|
|
|
</bean> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<bean id="content" class="com.springsource.samples.rest.SampleContentAtomView"/></programlisting> |
|
|
|
|
|
|
|
|
|
<para>The <classname>InternalResourceViewResolver</classname> handles |
|
|
|
|
the translation of view names and JSP pages while the |
|
|
|
|
@ -290,16 +290,16 @@ public class RelativePathUriTemplateController {
@@ -290,16 +290,16 @@ public class RelativePathUriTemplateController {
|
|
|
|
|
|
|
|
|
|
<programlisting language="java">@Controller |
|
|
|
|
public class ContentController { |
|
|
|
|
|
|
|
|
|
private List<SampleContent> contentList = new ArrayList<SampleContent>(); |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/content", method=RequestMethod.GET) |
|
|
|
|
public ModelAndView getContent() { |
|
|
|
|
ModelAndView mav = new ModelAndView(); |
|
|
|
|
mav.setViewName("content"); |
|
|
|
|
mav.addObject("sampleContentList", contentList); |
|
|
|
|
return mav; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private List<SampleContent> contentList = new ArrayList<SampleContent>(); |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/content", method=RequestMethod.GET) |
|
|
|
|
public ModelAndView getContent() { |
|
|
|
|
ModelAndView mav = new ModelAndView(); |
|
|
|
|
mav.setViewName("content"); |
|
|
|
|
mav.addObject("sampleContentList", contentList); |
|
|
|
|
return mav; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}</programlisting> |
|
|
|
|
|
|
|
|
|
@ -340,7 +340,7 @@ public class ContentController {
@@ -340,7 +340,7 @@ public class ContentController {
|
|
|
|
|
updated to support setting the HTTP method. For example, the following |
|
|
|
|
snippet taken from the updated Petclinic sample</para> |
|
|
|
|
|
|
|
|
|
<programlisting language="html"><form:form method="delete"> |
|
|
|
|
<programlisting language="xml"><form:form method="delete"> |
|
|
|
|
<p class="submit"><input type="submit" value="Delete Pet"/></p> |
|
|
|
|
</form:form></programlisting> |
|
|
|
|
|
|
|
|
|
|