url upload data

HttpPost httpPost = new HttpPost(url); //创建post
httpPost.addHeader("AUTH_TOKEN", token); //认证

ObjectMapper mapper = new ObjectMapper();
String jsonModel = mapper.writeValueAsString(obj); // create json content from obj(model).
StringEntity entity = new StringEntity(jsonModel, "utf-8");
entity.setContentType("application/json");
httpPost.setEntity(entity);

CloseableHttpClient httpclient = HttpClients.createDefault(); //client post
httpResponse = httpclient.execute(httpPost)

群交流(262200309)
原文地址:https://www.cnblogs.com/webster1/p/5006756.html