@Order(value=-2147483648) @ControllerAdvice public class JSONPResponseBodyAdvice extends Object implements org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice<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 |
---|---|
org.apache.commons.logging.Log |
logger |
Constructor and Description |
---|
JSONPResponseBodyAdvice() |
Modifier and Type | Method and Description |
---|---|
Object |
beforeBodyWrite(Object body,
org.springframework.core.MethodParameter returnType,
org.springframework.http.MediaType selectedContentType,
Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> selectedConverterType,
org.springframework.http.server.ServerHttpRequest request,
org.springframework.http.server.ServerHttpResponse response) |
void |
beforeBodyWriteInternal(JSONPObject jsonpObject,
org.springframework.http.MediaType contentType,
org.springframework.core.MethodParameter returnType,
org.springframework.http.server.ServerHttpRequest request,
org.springframework.http.server.ServerHttpResponse response) |
boolean |
supports(org.springframework.core.MethodParameter returnType,
Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> converterType) |
public boolean supports(org.springframework.core.MethodParameter returnType, Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> converterType)
supports
in interface org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice<Object>
public Object beforeBodyWrite(Object body, org.springframework.core.MethodParameter returnType, org.springframework.http.MediaType selectedContentType, Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> selectedConverterType, org.springframework.http.server.ServerHttpRequest request, org.springframework.http.server.ServerHttpResponse response)
beforeBodyWrite
in interface org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice<Object>
public void beforeBodyWriteInternal(JSONPObject jsonpObject, org.springframework.http.MediaType contentType, org.springframework.core.MethodParameter returnType, org.springframework.http.server.ServerHttpRequest request, org.springframework.http.server.ServerHttpResponse response)
Copyright © 2012–2022 Alibaba Group. All rights reserved.