java post 请求
public static String jsonPost(String url, JSONObject jsonObject){
CloseableHttpClient httpclient = HttpClientBuilder.create().build();
HttpPost post = new HttpPost(url);
String response = null;
try {
StringEntity s = new StringEntity(jsonObject.toString());
s.setContentEncoding("UTF-8");
s.setContentType("application/json");//发送json数据需要设置contentType
post.setEntity(s);
HttpResponse res = httpclient.execute(post);
if(res.getStatusLine().getStatusCode() == HttpStatus.SC_OK){
String result = EntityUtils.toString(res.getEntity());// 返回json格式:
response = JSONObject.toJSONString(result);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return response;
}
你好,麻烦具体描述下问题流程,提供下appid,完整的请求,最近一次操作时间(特别说明,5小时内才有机会快速定位)