Fix links in MVC chapter
Issue: SPR-9344
This commit is contained in:
@@ -868,9 +868,9 @@ public class ClinicController {
|
|||||||
<classname>RequestMappingHandlerAdapter</classname> respectively.
|
<classname>RequestMappingHandlerAdapter</classname> respectively.
|
||||||
They are recommended for use and even required to take advantage of
|
They are recommended for use and even required to take advantage of
|
||||||
new features in Spring MVC 3.1 and going forward. The new support
|
new features in Spring MVC 3.1 and going forward. The new support
|
||||||
classes are enabled by default by the MVC namespace and MVC Java
|
classes are enabled by default by the MVC namespace and the MVC Java
|
||||||
config (<classname>@EnableWebMvc</classname>) but must be configured
|
config but must be configured explicitly if using neither.
|
||||||
explicitly if using neither. This section describes a few
|
This section describes a few
|
||||||
important differences between the old and the new support classes.
|
important differences between the old and the new support classes.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@@ -1181,7 +1181,7 @@ public class RelativePathUriTemplateController {
|
|||||||
They are recommended for use and even required to take advantage
|
They are recommended for use and even required to take advantage
|
||||||
of new features in Spring MVC 3.1 and going forward.
|
of new features in Spring MVC 3.1 and going forward.
|
||||||
The new support classes are enabled by default from the MVC namespace and
|
The new support classes are enabled by default from the MVC namespace and
|
||||||
with use of the MVC Java config (<code>@EnableWebMvc</code>) but must be
|
with use of the MVC Java config but must be
|
||||||
configured explicitly if using neither.
|
configured explicitly if using neither.
|
||||||
</para></note>
|
</para></note>
|
||||||
|
|
||||||
@@ -1550,16 +1550,20 @@ public void handle(@RequestBody String body, Writer writer) throws IOException {
|
|||||||
|
|
||||||
<para>For more information on these converters, see <link
|
<para>For more information on these converters, see <link
|
||||||
linkend="rest-message-conversion">Message Converters</link>. Also note
|
linkend="rest-message-conversion">Message Converters</link>. Also note
|
||||||
that if using the MVC namespace, a wider range of message converters
|
that if using the MVC namespace or the MVC Java config, a wider
|
||||||
are registered by default. See <xref
|
range of message converters are registered by default.
|
||||||
linkend="mvc-annotation-driven" /> for more information.</para>
|
See <link linkend="mvc-config-enable">Enabling the MVC Java Config or
|
||||||
|
the MVC XML Namespace</link> for more information.</para>
|
||||||
|
|
||||||
<para>If you intend to read and write XML, you will need to configure
|
<para>If you intend to read and write XML, you will need to configure
|
||||||
the <classname>MarshallingHttpMessageConverter</classname> with a
|
the <classname>MarshallingHttpMessageConverter</classname> with a
|
||||||
specific <interfacename>Marshaller</interfacename> and an
|
specific <interfacename>Marshaller</interfacename> and an
|
||||||
<interfacename>Unmarshaller</interfacename> implementation from the
|
<interfacename>Unmarshaller</interfacename> implementation from the
|
||||||
<classname>org.springframework.oxm</classname> package. For
|
<classname>org.springframework.oxm</classname> package. The example
|
||||||
example:</para>
|
below shows how to do that directly in your configuration but if
|
||||||
|
your application is configured through the MVC namespace or the
|
||||||
|
MVC Java config see <link linkend="mvc-config-enable">Enabling
|
||||||
|
the MVC Java Config or the MVC XML Namespace</link> instead.</para>
|
||||||
|
|
||||||
<programlisting language="xml"><bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
|
<programlisting language="xml"><bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
|
||||||
<property name="messageConverters">
|
<property name="messageConverters">
|
||||||
@@ -1584,7 +1588,7 @@ public void handle(@RequestBody String body, Writer writer) throws IOException {
|
|||||||
<para>An <classname>@RequestBody</classname> method parameter can be
|
<para>An <classname>@RequestBody</classname> method parameter can be
|
||||||
annotated with <classname>@Valid</classname>, in which case it will be
|
annotated with <classname>@Valid</classname>, in which case it will be
|
||||||
validated using the configured <classname>Validator</classname>
|
validated using the configured <classname>Validator</classname>
|
||||||
instance. When using the MVC namespace or Java config, a JSR-303 validator
|
instance. When using the MVC namespace or the MVC Java config, a JSR-303 validator
|
||||||
is configured automatically assuming a JSR-303 implementation is
|
is configured automatically assuming a JSR-303 implementation is
|
||||||
available on the classpath.</para>
|
available on the classpath.</para>
|
||||||
<para>Just like with <classname>@ModelAttribute</classname> parameters,
|
<para>Just like with <classname>@ModelAttribute</classname> parameters,
|
||||||
@@ -1596,9 +1600,10 @@ public void handle(@RequestBody String body, Writer writer) throws IOException {
|
|||||||
a <literal>400</literal> error back to the client.</para>
|
a <literal>400</literal> error back to the client.</para>
|
||||||
|
|
||||||
<note>
|
<note>
|
||||||
<para>Also see <xref linkend="mvc-annotation-driven" /> for
|
<para>Also see <link linkend="mvc-config-enable">Enabling the MVC
|
||||||
|
Java Config or the MVC XML Namespace</link> for
|
||||||
information on configuring message converters and a validator
|
information on configuring message converters and a validator
|
||||||
through the MVC namespace.</para>
|
through the MVC namespace or the MVC Java config.</para>
|
||||||
</note>
|
</note>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -1951,8 +1956,7 @@ public class EditPetForm {
|
|||||||
<interfacename>RedirectAttributes</interfacename> or if it doesn't do
|
<interfacename>RedirectAttributes</interfacename> or if it doesn't do
|
||||||
so no attributes should be passed on to
|
so no attributes should be passed on to
|
||||||
<classname>RedirectView</classname>. Both the MVC namespace and the
|
<classname>RedirectView</classname>. Both the MVC namespace and the
|
||||||
MVC Java config (via <interfacename>@EnableWebMvc</interfacename>)
|
MVC Java config keep this flag set to <literal>false</literal> in order to maintain
|
||||||
keep this flag set to <literal>false</literal> in order to maintain
|
|
||||||
backwards compatibility. However, for new applications we recommend
|
backwards compatibility. However, for new applications we recommend
|
||||||
setting it to <literal>true</literal></para>
|
setting it to <literal>true</literal></para>
|
||||||
|
|
||||||
@@ -2435,8 +2439,10 @@ public class TimeBasedAccessInterceptor extends HandlerInterceptorAdapter {
|
|||||||
<para>In the example above, the configured interceptor will apply to
|
<para>In the example above, the configured interceptor will apply to
|
||||||
all requests handled with annotated controller methods. If you want to
|
all requests handled with annotated controller methods. If you want to
|
||||||
narrow down the URL paths to which an interceptor applies, you can use
|
narrow down the URL paths to which an interceptor applies, you can use
|
||||||
the MVC namespace to do that. See <xref
|
the MVC namespace or the MVC Java config, or declare bean instances
|
||||||
linkend="mvc-annotation-driven" />.</para>
|
of type <classname>MappedInterceptor</classname> to do that. See <link
|
||||||
|
linkend="mvc-config-enable">Enabling the MVC Java Config or the MVC
|
||||||
|
XML Namespace</link>.</para>
|
||||||
</tip>
|
</tip>
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
@@ -3684,8 +3690,8 @@ public String onSubmit(<emphasis role="bold">@RequestPart("meta-data") MetaData
|
|||||||
methods from any controller.
|
methods from any controller.
|
||||||
The <interfacename>@ControllerAdvice</interfacename> annotation is
|
The <interfacename>@ControllerAdvice</interfacename> annotation is
|
||||||
a component annotation, which can be used with classpath scanning. It is
|
a component annotation, which can be used with classpath scanning. It is
|
||||||
automatically enabled when using the MVC namespace and Java config, or
|
automatically enabled when using the MVC namespace and the MVC Java config,
|
||||||
otherwise depending on whether the
|
or otherwise depending on whether the
|
||||||
<classname>ExceptionHandlerExceptionResolver</classname> is configured or not.
|
<classname>ExceptionHandlerExceptionResolver</classname> is configured or not.
|
||||||
Below is an example of a controller-local
|
Below is an example of a controller-local
|
||||||
<interfacename>@ExceptionHandler</interfacename> method:</para>
|
<interfacename>@ExceptionHandler</interfacename> method:</para>
|
||||||
@@ -3742,7 +3748,7 @@ public class SimpleController {
|
|||||||
|
|
||||||
<para>The <classname>DefaultHandlerExceptionResolver</classname> translates
|
<para>The <classname>DefaultHandlerExceptionResolver</classname> translates
|
||||||
Spring MVC exceptions to specific error status codes. It is registered
|
Spring MVC exceptions to specific error status codes. It is registered
|
||||||
by default with the MVC namespace, the MVC Java config. and also by the
|
by default with the MVC namespace, the MVC Java config, and also by the
|
||||||
the <classname>DispatcherServlet</classname> (i.e. when not using the MVC
|
the <classname>DispatcherServlet</classname> (i.e. when not using the MVC
|
||||||
namespace or Java config). Listed below are some of the exceptions handled
|
namespace or Java config). Listed below are some of the exceptions handled
|
||||||
by this resolver and the corresponding status codes:
|
by this resolver and the corresponding status codes:
|
||||||
@@ -4319,7 +4325,7 @@ public class ErrorController {
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<section id="mvc-config-enable">
|
<section id="mvc-config-enable">
|
||||||
<title>Enabling MVC Java Config or the MVC XML Namespace</title>
|
<title>Enabling the MVC Java Config or the MVC XML Namespace</title>
|
||||||
|
|
||||||
<para>To enable MVC Java config add the annotation
|
<para>To enable MVC Java config add the annotation
|
||||||
<interfacename>@EnableWebMvc</interfacename> to one of your
|
<interfacename>@EnableWebMvc</interfacename> to one of your
|
||||||
|
|||||||
Reference in New Issue
Block a user