From b3f0b6e2d664bf232e3468acac2eba0e39dab4ab Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Wed, 22 Aug 2012 11:25:29 -0400 Subject: [PATCH] Fix links in MVC chapter Issue: SPR-9344 --- src/reference/docbook/mvc.xml | 46 ++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/src/reference/docbook/mvc.xml b/src/reference/docbook/mvc.xml index 3b8d17ebe22..40a89c7c9a8 100644 --- a/src/reference/docbook/mvc.xml +++ b/src/reference/docbook/mvc.xml @@ -868,9 +868,9 @@ public class ClinicController { RequestMappingHandlerAdapter respectively. 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 - classes are enabled by default by the MVC namespace and MVC Java - config (@EnableWebMvc) but must be configured - explicitly if using neither. This section describes a few + classes are enabled by default by the MVC namespace and the MVC Java + config but must be configured explicitly if using neither. + This section describes a few important differences between the old and the new support classes. @@ -1181,7 +1181,7 @@ public class RelativePathUriTemplateController { 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 classes are enabled by default from the MVC namespace and - with use of the MVC Java config (@EnableWebMvc) but must be + with use of the MVC Java config but must be configured explicitly if using neither. @@ -1550,16 +1550,20 @@ public void handle(@RequestBody String body, Writer writer) throws IOException { For more information on these converters, see Message Converters. Also note - that if using the MVC namespace, a wider range of message converters - are registered by default. See for more information. + that if using the MVC namespace or the MVC Java config, a wider + range of message converters are registered by default. + See Enabling the MVC Java Config or + the MVC XML Namespace for more information. If you intend to read and write XML, you will need to configure the MarshallingHttpMessageConverter with a specific Marshaller and an Unmarshaller implementation from the - org.springframework.oxm package. For - example: + org.springframework.oxm package. The example + 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 Enabling + the MVC Java Config or the MVC XML Namespace instead. <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"> <property name="messageConverters"> @@ -1584,7 +1588,7 @@ public void handle(@RequestBody String body, Writer writer) throws IOException { An @RequestBody method parameter can be annotated with @Valid, in which case it will be validated using the configured Validator - 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 available on the classpath. Just like with @ModelAttribute parameters, @@ -1596,9 +1600,10 @@ public void handle(@RequestBody String body, Writer writer) throws IOException { a 400 error back to the client. - Also see for + Also see Enabling the MVC + Java Config or the MVC XML Namespace for information on configuring message converters and a validator - through the MVC namespace. + through the MVC namespace or the MVC Java config. @@ -1951,8 +1956,7 @@ public class EditPetForm { RedirectAttributes or if it doesn't do so no attributes should be passed on to RedirectView. Both the MVC namespace and the - MVC Java config (via @EnableWebMvc) - keep this flag set to false in order to maintain + MVC Java config keep this flag set to false in order to maintain backwards compatibility. However, for new applications we recommend setting it to true @@ -2435,8 +2439,10 @@ public class TimeBasedAccessInterceptor extends HandlerInterceptorAdapter { In the example above, the configured interceptor will apply 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 - the MVC namespace to do that. See . + the MVC namespace or the MVC Java config, or declare bean instances + of type MappedInterceptor to do that. See Enabling the MVC Java Config or the MVC + XML Namespace. @@ -3684,8 +3690,8 @@ public String onSubmit(@RequestPart("meta-data") MetaData methods from any controller. The @ControllerAdvice annotation is a component annotation, which can be used with classpath scanning. It is - automatically enabled when using the MVC namespace and Java config, or - otherwise depending on whether the + automatically enabled when using the MVC namespace and the MVC Java config, + or otherwise depending on whether the ExceptionHandlerExceptionResolver is configured or not. Below is an example of a controller-local @ExceptionHandler method: @@ -3742,7 +3748,7 @@ public class SimpleController { The DefaultHandlerExceptionResolver translates 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 DispatcherServlet (i.e. when not using the MVC namespace or Java config). Listed below are some of the exceptions handled by this resolver and the corresponding status codes: @@ -4319,7 +4325,7 @@ public class ErrorController {
- Enabling MVC Java Config or the MVC XML Namespace + Enabling the MVC Java Config or the MVC XML Namespace To enable MVC Java config add the annotation @EnableWebMvc to one of your