try {
URIBuilder builder = new URIBuilder(url).addParameter(ApproveConstant.APPID, content.getAppid());
url = builder.build().toString();
} catch (URISyntaxException e) {
log.error(e.getMessage(), e);;
}
String result = httpPost(url, params);
private String httpPost(String url, JSONObject json){
String response = null;
logger.info("提交云上JSON : "+json);
try {
response = Request.Post(url).bodyString(json.toJSONString(), ContentType.APPLICATION_JSON).execute()
.returnContent().asString(Consts.UTF_8);
return response;
} catch (ClientProtocolException e) {
logger.error(response + ",error:" + e.getMessage());
if (StringUtils.isBlank(response))
response = "[" + url + "]:" + ExceptionUtils.getFullStackTrace(e);
throw new RuntimeException(response);
} catch (IOException e) {
logger.error(response + ",error:" + e.getMessage());
if (StringUtils.isBlank(response))
response = "[" + url + "]:" + ExceptionUtils.getFullStackTrace(e);
throw new RuntimeException(response);
} catch (Throwable e) {
logger.error(response + ",error:" + e.getMessage());
if (StringUtils.isBlank(response))
response = e.getMessage();
throw new RuntimeException(response);
}