Bläddra i källkod

修复bug:HttpUtil中map转SwMap失败

4.0
FLYPHT 2 år sedan
förälder
incheckning
2d7cd82bca
1 ändrade filer med 24 tillägg och 4 borttagningar
  1. +24
    -4
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/util/HttpUtil.java

+ 24
- 4
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/util/HttpUtil.java Visa fil

@@ -107,7 +107,12 @@ public class HttpUtil {
public static SwMap post(String url, Map<String, String> paras) throws Exception {
String json_resp = post(url, null, paras, null);
if (StringUtils.isEmpty(json_resp) || !json_resp.startsWith("{")) return null;
return (SwMap) JsonUtil.parseMap(json_resp);
SwMap swMap = new SwMap();
Map map = JsonUtil.parseMap(json_resp);
if(map!=null){
swMap.putAll(map);
}
return swMap;
}

/**
@@ -147,7 +152,12 @@ public class HttpUtil {
json_resp = new String(Base64.decodeBase64(json_resp), charset);
}
if (StringUtils.isEmpty(json_resp) || !json_resp.startsWith("{")) return null;
return (SwMap) JsonUtil.parseMap(json_resp);
SwMap swMap = new SwMap();
Map map = JsonUtil.parseMap(json_resp);
if(map!=null){
swMap.putAll(map);
}
return swMap;
}

/**
@@ -169,14 +179,24 @@ public class HttpUtil {
json_resp = new String(Base64.decodeBase64(json_resp), charset);
}
if (StringUtils.isEmpty(json_resp) || !json_resp.startsWith("{")) return null;
return (SwMap) JsonUtil.parseMap(json_resp);
SwMap swMap = new SwMap();
Map map = JsonUtil.parseMap(json_resp);
if(map!=null){
swMap.putAll(map);
}
return swMap;
}


public static SwMap post(String url, Map<String, String> header, Map<String, String> paras) throws Exception {
String json_resp = post(url, header, paras, null);
if (StringUtils.isEmpty(json_resp) || !json_resp.startsWith("{")) return null;
return (SwMap) JsonUtil.parseMap(json_resp);
SwMap swMap = new SwMap();
Map map = JsonUtil.parseMap(json_resp);
if(map!=null){
swMap.putAll(map);
}
return swMap;
}

/**


Laddar…
Avbryt
Spara