【发布时间】:2012-04-16 21:21:00
【问题描述】:
我正在实现 httpclient 响应处理程序。正在拨打的电话是post 像这样
result = httpclient.execute(httppost, responsehandler);
现在我想实现我的响应处理程序。这样我就可以获取我的响应的状态代码。我只对状态码感兴趣,即 200、404、403,然后我想将此响应作为 int 值返回
类似
public class MyResponseHandler implements ResponseHandler<Integer> {
public Integer handleResponse(HttpResponse respons) throws ClientProtocolException, IOException {
// TODO Auto-generated method stub
return 0;
}
现在的问题是,我在响应对象中看不到任何 response.getStatusCode() 方法。如何获取我的 WS 调用的状态码?
【问题讨论】:
标签: java web-services apache httpclient