public static String send(String url, JSONObject json, String encoding) throws ParseException, IOException {
String body = "";
//创建httpclient对象
CloseableHttpClient client = HttpClients.createDefault();
//创建post方式请求对象
HttpPost httpPost = new HttpPost(url);
//装填参数
StringEntity s = new StringEntity(json
Java使用Http实现post
最新推荐文章于 2024-06-13 10:21:43 发布
本文介绍如何在Java中使用HTTP实现POST请求,重点在于处理JSON对象的上传。通过指定URL、JSON数据和编码方式,可以获取到请求的字符串响应。
摘要由CSDN通过智能技术生成