@@ -1483,7 +1483,6 @@ as the following example shows:
1483
1483
----
1484
1484
<1> Using a `consumes` attribute to narrow the mapping by the content type.
1485
1485
1486
-
1487
1486
The `consumes` attribute also supports negation expressions -- for example, `!text/plain` means any
1488
1487
content type other than `text/plain`.
1489
1488
@@ -1513,7 +1512,6 @@ content types that a controller method produces, as the following example shows:
1513
1512
----
1514
1513
<1> Using a `produces` attribute to narrow the mapping by the content type.
1515
1514
1516
-
1517
1515
The media type can specify a character set. Negated expressions are supported -- for example,
1518
1516
`!text/plain` means any content type other than "text/plain".
1519
1517
@@ -1548,7 +1546,6 @@ specific value (`myParam=myValue`). The following example shows how to test for
1548
1546
----
1549
1547
<1> Testing whether `myParam` equals `myValue`.
1550
1548
1551
-
1552
1549
You can also use the same with request header conditions, as the following example shows:
1553
1550
1554
1551
[source,java,indent=0]
@@ -1561,7 +1558,6 @@ You can also use the same with request header conditions, as the following examp
1561
1558
----
1562
1559
<1> Testing whether `myHeader` equals `myValue`.
1563
1560
1564
-
1565
1561
TIP: You can match `Content-Type` and `Accept` with the headers condition, but it is better to use
1566
1562
<<mvc-ann-requestmapping-consumes, consumes>> and <<mvc-ann-requestmapping-produces, produces>>
1567
1563
instead.
@@ -1650,7 +1646,6 @@ public class MyConfig {
1650
1646
1651
1647
1652
1648
1653
-
1654
1649
[[mvc-ann-methods]]
1655
1650
=== Handler Methods
1656
1651
[.small]#<<web-reactive.adoc#webflux-ann-methods, Same as in Spring WebFlux>>#
@@ -2030,7 +2025,6 @@ The following example shows how to do so:
2030
2025
----
2031
2026
<1> Using `@RequestParam` to bind `petId`.
2032
2027
2033
-
2034
2028
By default, method parameters that use this annotation are required, but you can specify that
2035
2029
a method parameter is optional by setting the `@RequestParam` annotation's `required` flag to
2036
2030
`false` or by declaring the argument with an `java.util.Optional` wrapper.
@@ -2087,7 +2081,6 @@ The following example gets the value of the `Accept-Encoding` and `Keep-Alive` h
2087
2081
<1> Get the value of the `Accept-Encoding` header.
2088
2082
<2> Get the value of the `Keep-Alive` header.
2089
2083
2090
-
2091
2084
If the target method parameter type is not
2092
2085
`String`, type conversion is automatically applied. See <<mvc-ann-typeconversion>>.
2093
2086
@@ -2151,7 +2144,6 @@ converting individual query parameters and form fields. The following example sh
2151
2144
----
2152
2145
<1> Bind an instance of `Pet`.
2153
2146
2154
-
2155
2147
The `Pet` instance above is resolved as follows:
2156
2148
2157
2149
* From the model if already added by using <<mvc-ann-modelattrib-methods>>.
@@ -2201,7 +2193,6 @@ to the `@ModelAttribute`, as the following example shows:
2201
2193
----
2202
2194
<1> Adding a `BindingResult` next to the `@ModelAttribute`.
2203
2195
2204
-
2205
2196
In some cases, you may want access to a model attribute without data binding. For such
2206
2197
cases, you can inject the `Model` into the controller and access it directly or,
2207
2198
alternatively, set `@ModelAttribute(binding=false)`, as the following example shows:
@@ -2227,7 +2218,6 @@ alternatively, set `@ModelAttribute(binding=false)`, as the following example sh
2227
2218
----
2228
2219
<1> Setting `@ModelAttribute(binding=false)`.
2229
2220
2230
-
2231
2221
You can automatically apply validation after data binding by adding the
2232
2222
`javax.validation.Valid` annotation or Spring's `@Validated` annotation (
2233
2223
<<core.adoc#validation-beanvalidation, Bean Validation>> and
@@ -2246,7 +2236,6 @@ You can automatically apply validation after data binding by adding the
2246
2236
----
2247
2237
<1> Validate the `Pet` instance.
2248
2238
2249
-
2250
2239
Note that using `@ModelAttribute` is optional (for example, to set its attributes).
2251
2240
By default, any argument that is not a simple value type (as determined by
2252
2241
{api-spring-framework}/beans/BeanUtils.html#isSimpleProperty-java.lang.Class-[BeanUtils#isSimpleProperty])
@@ -2277,7 +2266,6 @@ The following example uses the `@SessionAttributes` annotation:
2277
2266
----
2278
2267
<1> Using the `@SessionAttributes` annotation.
2279
2268
2280
-
2281
2269
On the first request, when a model attribute with the name, `pet`, is added to the model,
2282
2270
it is automatically promoted to and saved in the HTTP Servlet session. It remains there
2283
2271
until another controller method uses a `SessionStatus` method argument to clear the
@@ -2307,7 +2295,6 @@ storage, as the following example shows:
2307
2295
<2> Clearing the `Pet` value from the Servlet session.
2308
2296
2309
2297
2310
-
2311
2298
[[mvc-ann-sessionattribute]]
2312
2299
==== `@SessionAttribute`
2313
2300
[.small]#<<web-reactive.adoc#webflux-ann-sessionattribute, Same as in Spring WebFlux>>#
@@ -2327,7 +2314,6 @@ as the following example shows:
2327
2314
----
2328
2315
<1> Using a `@SessionAttribute` annotation.
2329
2316
2330
-
2331
2317
For use cases that require adding or removing session attributes, consider injecting
2332
2318
`org.springframework.web.context.request.WebRequest` or
2333
2319
`javax.servlet.http.HttpSession` into the controller method.
@@ -2356,7 +2342,6 @@ or `HandlerInterceptor`):
2356
2342
<1> Using the `@RequestAttribute` annotation.
2357
2343
2358
2344
2359
-
2360
2345
[[mvc-redirecting-passing-data]]
2361
2346
==== Redirect Attributes
2362
2347
@@ -2872,7 +2857,6 @@ The following listing shows an example:
2872
2857
----
2873
2858
<1> Defining an `@InitBinder` method.
2874
2859
2875
-
2876
2860
Alternatively, when you use a `Formatter`-based setup through a shared
2877
2861
`FormattingConversionService`, you can re-use the same approach and register
2878
2862
controller-specific `Formatter` implementations, as the following example shows:
@@ -2895,7 +2879,6 @@ controller-specific `Formatter` implementations, as the following example shows:
2895
2879
2896
2880
2897
2881
2898
-
2899
2882
[[mvc-ann-exceptionhandler]]
2900
2883
=== Exceptions
2901
2884
[.small]#<<web-reactive.adoc#webflux-ann-controller-exceptions, Same as in Spring WebFlux>>#
@@ -3901,7 +3884,6 @@ as the following example shows:
3901
3884
<2> The response has been set to 304 (NOT_MODIFIED) -- no further processing.
3902
3885
<3> Continue with the request processing.
3903
3886
3904
-
3905
3887
There are three variants for checking conditional requests against `eTag` values, `lastModified`
3906
3888
values, or both. For conditional `GET` and `HEAD` requests, you can set the response to
3907
3889
304 (NOT_MODIFIED). For conditional `POST`, `PUT`, and `DELETE`, you can instead set the response
0 commit comments