public class JSONPResponseBodyAdvice extends Object
Wrap with the return object from method annotated by @ResponseJSONP
in order to be serialized into jsonp format.
url: /path/to/your/api?callback=functionName
In Spring 3.x, use method directly return a JSONPObject instead.
JSONPObject,
ResponseJSONP| Modifier and Type | Field and Description |
|---|---|
Log |
logger |
| Constructor and Description |
|---|
JSONPResponseBodyAdvice() |
| Modifier and Type | Method and Description |
|---|---|
Object |
beforeBodyWrite(Object body,
MethodParameter returnType,
MediaType selectedContentType,
Class<? extends <any>> selectedConverterType,
ServerHttpRequest request,
ServerHttpResponse response) |
void |
beforeBodyWriteInternal(JSONPObject jsonpObject,
MediaType contentType,
MethodParameter returnType,
ServerHttpRequest request,
ServerHttpResponse response) |
protected MediaType |
getContentType(MediaType contentType,
ServerHttpRequest request,
ServerHttpResponse response)
Return the content type to set the response to.
|
boolean |
supports(MethodParameter returnType,
Class<? extends <any>> converterType) |
public boolean supports(MethodParameter returnType,
Class<? extends <any>> converterType)
public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType, Class<? extends <any>> selectedConverterType, ServerHttpRequest request, ServerHttpResponse response)
public void beforeBodyWriteInternal(JSONPObject jsonpObject, MediaType contentType, MethodParameter returnType, ServerHttpRequest request, ServerHttpResponse response)
protected MediaType getContentType(MediaType contentType,
ServerHttpRequest request,
ServerHttpResponse response)
contentType - the content type selected through content negotiationrequest - the current requestresponse - the current responseCopyright © 2023. All rights reserved.