@@ -484,7 +484,6 @@ Portlet facilities.
484
484
485
485
[TIP]
486
486
====
487
-
488
487
Available in the https://github.com/spring-projects/[spring-projects Org on Github],
489
488
a number of web applications leverage the annotation support described in this section
490
489
including __MvcShowcase__, __MvcAjax__, __MvcBasic__, __PetClinic__, __PetCare__,
@@ -800,7 +799,6 @@ the value of `ownerId` is `fred`.
800
799
801
800
[TIP]
802
801
====
803
-
804
802
To process the @PathVariable annotation, Spring MVC needs to find the matching URI
805
803
template variable by name. You can specify it in the annotation:
806
804
@@ -1098,7 +1096,6 @@ default it is set to `true`.
1098
1096
1099
1097
[TIP]
1100
1098
====
1101
-
1102
1099
The MVC Java config and the MVC namespace both provide options for enabling the use of
1103
1100
matrix variables.
1104
1101
@@ -1151,7 +1148,6 @@ using constants provided in `MediaType` such as `APPLICATION_JSON_VALUE` and
1151
1148
1152
1149
[TIP]
1153
1150
====
1154
-
1155
1151
The __consumes__ condition is supported on the type and on the method level. Unlike most
1156
1152
other conditions, when used at the type level, method-level consumable types override
1157
1153
rather than extend type-level consumable types.
@@ -1239,7 +1235,6 @@ specific request header value:
1239
1235
1240
1236
[TIP]
1241
1237
====
1242
-
1243
1238
Although you can match to __Content-Type__ and __Accept__ header values using media type
1244
1239
wild cards (for example __"content-type=text/*"__ will match to __"text/plain"__ and
1245
1240
__"text/html"__), it is recommended to use the __consumes__ and __produces__ conditions
@@ -1697,7 +1692,6 @@ for more details.
1697
1692
1698
1693
[TIP]
1699
1694
====
1700
-
1701
1695
What happens when a model attribute name is not explicitly specified? In such cases a
1702
1696
default name is assigned to the model attribute based on its type. For example if the
1703
1697
method returns an object of type `Account`, the default name used is "account". You can
@@ -2468,7 +2462,7 @@ the response.
2468
2462
[[mvc-ann-async-sse]]
2469
2463
==== HTTP Streaming With Server-Sent Events
2470
2464
2471
- `SseEmitter` is a sub-class of `ResponseBodyEmitter` providing support for
2465
+ `SseEmitter` is a subclass of `ResponseBodyEmitter` providing support for
2472
2466
http://www.w3.org/TR/eventsource/[Server-Sent Events].
2473
2467
Server-sent events is a just another variation on the same "HTTP Streaming"
2474
2468
technique except events pushed from the server are formatted according to
@@ -2752,7 +2746,6 @@ extend the `HandlerInterceptor` interface.
2752
2746
2753
2747
[TIP]
2754
2748
====
2755
-
2756
2749
In the example above, the configured interceptor will apply to all requests handled with
2757
2750
annotated controller methods. If you want to narrow down the URL paths to which an
2758
2751
interceptor applies, you can use the MVC namespace or the MVC Java config, or declare
@@ -2768,6 +2761,7 @@ directly on `RequestMappingHandlerAdapter`.
2768
2761
2769
2762
2770
2763
2764
+
2771
2765
[[mvc-viewresolver]]
2772
2766
== Resolving views
2773
2767
All MVC frameworks for web applications provide a way to address views. Spring provides
@@ -3271,7 +3265,7 @@ You can also expand and encode using individual URI components:
3271
3265
.encode();
3272
3266
----
3273
3267
3274
- In a Servlet environment the `ServletUriComponentsBuilder` sub-class provides static
3268
+ In a Servlet environment the `ServletUriComponentsBuilder` subclass provides static
3275
3269
factory methods to copy available URL information from a Servlet requests:
3276
3270
3277
3271
[source,java,indent=0]
@@ -3971,7 +3965,7 @@ error content to the body of the response.
3971
3965
3972
3966
You can do that with `@ExceptionHandler` methods. When declared within a controller such
3973
3967
methods apply to exceptions raised by `@RequestMapping` methods of that controller (or
3974
- any of its sub-classes ). You can also declare an `@ExceptionHandler` method within an
3968
+ any of its subclasses ). You can also declare an `@ExceptionHandler` method within an
3975
3969
`@ControllerAdvice` class in which case it handles exceptions from `@RequestMapping`
3976
3970
methods from many controllers. Below is an example of a controller-local
3977
3971
`@ExceptionHandler` method:
@@ -3998,6 +3992,16 @@ is thrown that matches one of the types in the list, then the method annotated w
3998
3992
matching `@ExceptionHandler` will be invoked. If the annotation value is not set then
3999
3993
the exception types listed as method arguments are used.
4000
3994
3995
+ [TIP]
3996
+ ====
3997
+ For `@ExceptionHandler` methods, a root exception match will be preferred to just
3998
+ matching a cause of the current exception, among the handler methods of a particular
3999
+ controller or advice bean. However, a cause match on a higher-priority `@ControllerAdvice`
4000
+ will still be preferred to a any match (whether root or cause level) on a lower-priority
4001
+ advice bean. As a consequence, when using a multi-advice arrangement, please declare your
4002
+ primary root exception mappings on a prioritized advice bean with a corresponding order!
4003
+ ====
4004
+
4001
4005
Much like standard controller methods annotated with a `@RequestMapping` annotation, the
4002
4006
method arguments and return values of `@ExceptionHandler` methods can be flexible. For
4003
4007
example, the `HttpServletRequest` can be accessed in Servlet environments and the
@@ -4393,12 +4397,10 @@ then resolved into the `/WEB-INF/jsp/registration.jsp` view by the
4393
4397
4394
4398
[TIP]
4395
4399
====
4396
-
4397
4400
You do not need to define a `DefaultRequestToViewNameTranslator` bean explicitly. If you
4398
4401
like the default settings of the `DefaultRequestToViewNameTranslator`, you can rely on
4399
4402
the Spring Web MVC `DispatcherServlet` to instantiate an instance of this class if one
4400
4403
is not explicitly configured.
4401
-
4402
4404
====
4403
4405
4404
4406
Of course, if you need to change the default settings, then you do need to configure
0 commit comments