当java源文件请求服务器时,返回数据一步相应,可以利用HttpClientUtil这个工具
例如:String url = "http://10.0.64.236:8080/asoapi/config/get_system_parameter?parameterCodes=AutoPublishForApplication&accessToken=001";
String responseString = HttpClientUtil.httpGet(url);
JSONObject responseJson = JSONObject.parseObject(responseString);
int resultCode = responseJson.getIntValue("resultCode");
if ( resultCode != 0 ) {
return "Get error autoPublishedFlag";
}
JSONObject dataJson = JSONObject.parseObject(responseJson.getString("data"));
String autoPublishedFlag = dataJson.getString("parameter1");