httpclient3访问如下:
[java]
view plain
copy
HttpClient client = new HttpClient(); GetMethod method = new GetMethod(url); int statusCode = client.executeMethod(method); method.getResponseBody();
在3中httpclient是类。
httpclient4:
[java]
view plain
copy
HttpClient client = new DefaultHttpClient(); HttpGet method = new HttpGet(url); HttpResponse httpResponse = client.execute(method); httpResponse.getEntity().getContent();
在4中httpclient是接口了。
差别还是比较大的。如果过度的话,还是要看官方文档的,特别是设置参数之类的。