标签:
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)
标签:
原文地址:http://www.cnblogs.com/webster1/p/5006756.html