You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: framework-docs/modules/ROOT/pages/web/webflux/controller/ann-methods/requestheader.adoc
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,7 +64,8 @@ array or collection of strings or other types known to the type conversion syste
64
64
example, a method parameter annotated with `@RequestHeader("Accept")` may be of type
65
65
`String` but also of `String[]` or `List<String>`.
66
66
67
-
We can further remove our dependency on Spring Web MVC by making `@RequestHeader` a meta-annotation on our own annotation. The next example demonstrates how we could do so on an annotation named `@LanguageRequestHeader`.
67
+
We can use `@RequestHeader` as a meta-annotation, so you can create custom annotations for repeatedly used headers, like the `Accept-Language` header.
68
+
The next example demonstrates how we could do this with an annotation named `@LanguageRequestHeader`:
68
69
69
70
[tabs]
70
71
======
@@ -91,7 +92,7 @@ annotation class LanguageRequestHeader
91
92
----
92
93
======
93
94
94
-
We have isolated our dependency on Spring MVC to a single file. Now that `@LanguageRequestHeader` has been specified, we can use it to signal to resolve our LanguageRequestHeader of the currently `Accept-Language` request header:
95
+
Now that `@LanguageRequestHeader` has been specified, we can use it to signal Spring to resolve our `@LanguageRequestHeader` from the current `Accept-Language` request header:
95
96
96
97
[tabs]
97
98
======
@@ -119,4 +120,4 @@ fun fetchProduct(@LanguageRequestHeader lang: String): Flux<Product> {
119
120
======
120
121
121
122
122
-
TIP: We can replace the lang parameter type from `String` to `java.util.Locale` or to our own Language enum, and Spring will handle the conversion of the header value.
123
+
TIP: We can replace the lang parameter type from `String` to `java.util.Locale` or to your own Language enum, and Spring will handle the conversion of the header value. You may need to implement the xref:core/validation/convert.adoc[`Converter`] interface and register it.
Copy file name to clipboardExpand all lines: framework-docs/modules/ROOT/pages/web/webmvc/mvc-controller/ann-methods/requestheader.adoc
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,7 +64,9 @@ array or collection of strings or other types known to the type conversion syste
64
64
example, a method parameter annotated with `@RequestHeader("Accept")` can be of type
65
65
`String` but also `String[]` or `List<String>`.
66
66
67
-
We can further remove our dependency on Spring Web MVC by making `@RequestHeader` a meta-annotation on our own annotation. The next example demonstrates how we could do so on an annotation named `@LanguageRequestHeader`.
67
+
68
+
We can use `@RequestHeader` as a meta-annotation, so you can create custom annotations for repeatedly used headers, like the `Accept-Language` header.
69
+
The next example demonstrates how we could do this with an annotation named `@LanguageRequestHeader`:
68
70
69
71
[tabs]
70
72
======
@@ -91,7 +93,7 @@ annotation class LanguageRequestHeader
91
93
----
92
94
======
93
95
94
-
We have isolated our dependency on Spring MVC to a single file. Now that `@LanguageRequestHeader` has been specified, we can use it to signal to resolve our LanguageRequestHeader of the currently `Accept-Language` request header:
96
+
Now that `@LanguageRequestHeader` has been specified, we can use it to signal Spring to resolve our `@LanguageRequestHeader` from the current `Accept-Language` request header:
95
97
96
98
[tabs]
97
99
======
@@ -119,4 +121,4 @@ fun fetchProduct(@LanguageRequestHeader lang: String): List<Product> {
119
121
======
120
122
121
123
122
-
TIP: We can replace the lang parameter type from `String` to `java.util.Locale` or to our own Language enum, and Spring will handle the conversion of the header value.
124
+
TIP: We can replace the lang parameter type from `String` to `java.util.Locale` or to your own Language enum, and Spring will handle the conversion of the header value. You may need to implement the xref:core/validation/convert.adoc[`Converter`] interface and register it.
0 commit comments