httpclinet 502 浏览器正常 怎么回事 直接上代码

匿名1号 2014-08-09 07:36:43
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpGet httpget = new HttpGet("http://www.gjjx.com.cn/login?hash=0.19097914644896308");
ResponseHandler<String> responseHandler = new ResponseHandler<String>() {

public String handleResponse(
final HttpResponse response) throws ClientProtocolException, IOException {
int status = response.getStatusLine().getStatusCode();
if (status >= 200 && status < 300) {
HttpEntity entity = response.getEntity();
return entity != null ? EntityUtils.toString(entity) : null;
} else {
throw new ClientProtocolException("Unexpected response status: " + status);
}
}

};
System.out.println(httpclient.execute(httpget, responseHandler));
...全文
257 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
gaofuqi 2014-08-09
  • 打赏
  • 举报
回复
这里已经回答了: http://bbs.csdn.net/topics/390855140

23,404

社区成员

发帖
与我相关
我的任务
社区描述
Java 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧