Update reference documentation for JSONP support
Issue: SPR-12113
This commit is contained in:
parent
7885a5975e
commit
06f1f495c2
|
|
@ -1063,7 +1063,8 @@ method has been added.
|
|||
summary vs. detail page). This is also supported with View-based rendering by
|
||||
adding the serialization view type as a model attribute under a special key.
|
||||
See <<mvc-ann-jsonview>> for details.
|
||||
* JSONP is now supported with Jackson.
|
||||
* JSONP is now supported with Jackson, both for <<mvc-ann-jsonp,response body methods>> and
|
||||
<<view-json-mapping,`View`-based rendering>>.
|
||||
* A new lifecycle option is available for intercepting `@ResponseBody` and `ResponseEntity`
|
||||
methods just after the controller method returns and before the response is written.
|
||||
To take advantage declare an `@ControllerAdvice` bean that implements `ResponseBodyAdvice`.
|
||||
|
|
@ -31710,9 +31711,27 @@ to the model:
|
|||
return "userView";
|
||||
}
|
||||
}
|
||||
|
||||
----
|
||||
|
||||
[[mvc-ann-jsonp]]
|
||||
===== Jackson JSONP Support
|
||||
|
||||
In order to enable http://en.wikipedia.org/wiki/JSONP[JSONP] support for your response
|
||||
body methods, declare an `@ControllerAdvice` as shown below:
|
||||
|
||||
[source,java,indent=0]
|
||||
[subs="verbatim,quotes"]
|
||||
----
|
||||
@ControllerAdvice
|
||||
public class JsonpAdvice extends AbstractJsonpResponseBodyAdvice {
|
||||
|
||||
public JsonpAdvice() {
|
||||
super("callback");
|
||||
}
|
||||
}
|
||||
----
|
||||
|
||||
|
||||
[[mvc-ann-async]]
|
||||
==== Asynchronous Request Processing
|
||||
Spring MVC 3.2 introduced Servlet 3 based asynchronous request processing. Instead of
|
||||
|
|
@ -37004,6 +37023,10 @@ annotations. When further control is needed, a custom `ObjectMapper` can be inje
|
|||
through the `ObjectMapper` property for cases where custom JSON
|
||||
serializers/deserializers need to be provided for specific types.
|
||||
|
||||
http://en.wikipedia.org/wiki/JSONP[JSONP] is supported and automatically enabled when
|
||||
the request has a query parameter named `jsonp` or `callback`. The JSONP query parameter
|
||||
name(s) could be customized thanks to the `JsonpParameterNames` property.
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue