@@ -1063,7 +1063,8 @@ method has been added.
1063
1063
summary vs. detail page). This is also supported with View-based rendering by
1064
1064
adding the serialization view type as a model attribute under a special key.
1065
1065
See <<mvc-ann-jsonview>> for details.
1066
- * JSONP is now supported with Jackson.
1066
+ * JSONP is now supported with Jackson, both for <<mvc-ann-jsonp,response body methods>> and
1067
+ <<view-json-mapping,`View`-based rendering>>.
1067
1068
* A new lifecycle option is available for intercepting `@ResponseBody` and `ResponseEntity`
1068
1069
methods just after the controller method returns and before the response is written.
1069
1070
To take advantage declare an `@ControllerAdvice` bean that implements `ResponseBodyAdvice`.
@@ -31710,8 +31711,26 @@ to the model:
31710
31711
return "userView";
31711
31712
}
31712
31713
}
31714
+ ----
31715
+
31716
+ [[mvc-ann-jsonp]]
31717
+ ===== Jackson JSONP Support
31718
+
31719
+ In order to enable http://en.wikipedia.org/wiki/JSONP[JSONP] support for your response
31720
+ body methods, declare an `@ControllerAdvice` as shown below:
31713
31721
31722
+ [source,java,indent=0]
31723
+ [subs="verbatim,quotes"]
31714
31724
----
31725
+ @ControllerAdvice
31726
+ public class JsonpAdvice extends AbstractJsonpResponseBodyAdvice {
31727
+
31728
+ public JsonpAdvice() {
31729
+ super("callback");
31730
+ }
31731
+ }
31732
+ ----
31733
+
31715
31734
31716
31735
[[mvc-ann-async]]
31717
31736
==== Asynchronous Request Processing
@@ -37004,6 +37023,10 @@ annotations. When further control is needed, a custom `ObjectMapper` can be inje
37004
37023
through the `ObjectMapper` property for cases where custom JSON
37005
37024
serializers/deserializers need to be provided for specific types.
37006
37025
37026
+ http://en.wikipedia.org/wiki/JSONP[JSONP] is supported and automatically enabled when
37027
+ the request has a query parameter named `jsonp` or `callback`. The JSONP query parameter
37028
+ name(s) could be customized thanks to the `JsonpParameterNames` property.
37029
+
37007
37030
37008
37031
37009
37032
0 commit comments