KJB_ROOTLESS_ARRAY -> DJB_ROOTLESS_ARRAY
This commit is contained in:
@@ -14,7 +14,7 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
|
|||||||
@RestControllerAdvice
|
@RestControllerAdvice
|
||||||
public class ApiResponseAdvice implements ResponseBodyAdvice<Object> {
|
public class ApiResponseAdvice implements ResponseBodyAdvice<Object> {
|
||||||
|
|
||||||
static final String KJB_ROOTLESS_ARRAY = "{ \"KJB_ROOTLESS_ARRAY\" : ";
|
private static final String DJB_ROOTLESS_ARRAY = "DJB_ROOTLESS_ARRAY";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supports(MethodParameter returnType, Class<? extends HttpMessageConverter<?>> converterType) {
|
public boolean supports(MethodParameter returnType, Class<? extends HttpMessageConverter<?>> converterType) {
|
||||||
@@ -40,8 +40,8 @@ public class ApiResponseAdvice implements ResponseBodyAdvice<Object> {
|
|||||||
try {
|
try {
|
||||||
Object root = JSONValue.parse(body);
|
Object root = JSONValue.parse(body);
|
||||||
|
|
||||||
if (root instanceof JSONObject && ((JSONObject) root).containsKey("KJB_ROOTLESS_ARRAY")) {
|
if (root instanceof JSONObject && ((JSONObject) root).containsKey(DJB_ROOTLESS_ARRAY)) {
|
||||||
JSONArray jsonArray = (JSONArray) ((JSONObject) root).get("KJB_ROOTLESS_ARRAY");
|
JSONArray jsonArray = (JSONArray) ((JSONObject) root).get(DJB_ROOTLESS_ARRAY);
|
||||||
return jsonArray.toJSONString();
|
return jsonArray.toJSONString();
|
||||||
} else {
|
} else {
|
||||||
return body;
|
return body;
|
||||||
|
|||||||
Reference in New Issue
Block a user