|
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.serializer.PropertyPreFilter;
|
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
|
import com.alibaba.fastjson.serializer.SimplePropertyPreFilter;
|
|
|
+import org.hsweb.web.core.utils.ThreadLocalUtils;
|
|
|
import org.springframework.http.HttpInputMessage;
|
|
|
import org.springframework.http.HttpOutputMessage;
|
|
|
import org.springframework.http.MediaType;
|
|
@@ -85,9 +86,11 @@ public class FastJsonHttpMessageConverter extends AbstractHttpMessageConverter<O
|
|
|
if (message.isSuccess() && message.isOnlyData())
|
|
|
obj = message.getData();
|
|
|
text = JSON.toJSONString(obj, parseFilter(message), features);
|
|
|
- if (!StringUtils.isNullOrEmpty(message.getCallback())) {
|
|
|
+ String callback = ThreadLocalUtils.get("jsonp-callback");
|
|
|
+ if (callback == null) message.getCallback();
|
|
|
+ if (!StringUtils.isNullOrEmpty(callback)) {
|
|
|
text = new StringBuilder()
|
|
|
- .append(message.getCallback())
|
|
|
+ .append(callback)
|
|
|
.append("(").append(text).append(")")
|
|
|
.toString();
|
|
|
}
|