| HttpUtil |
基于hpptclient4.x
第一个参数用来保持session连接
null或default:整个应用使用同一个session
createClient(name):为不同域名创建各自的session
HttpUtil.post(null, "http://www.anyboot.org", "UTF-8", "name", "zhang", "age", "20");
HttpUtil.post(HttpUtil.defaultClient(), "http://www.anyboot.org", "UTF-8", "name", "zhang", "age", "20");
HttpUtil.post(HttpUtil.createClient("deep"), "http://www.anyboot.org", "UTF-8", "name", "zhang", "age", "20");
HttpUtil.post(null, "http://www.anyboot.org", "UTF-8", "name", "zhang", "age", "20");
HttpEntity entity = new StringEntity(BeanUtil.map2json(map), "UTF-8");
String txt = HttpUtil.post(url, "UTF-8", entity).getText();
|