I am implementing httpclient response handler. The call which is being made is post like this
result = httpclient.execute(httppost, responsehandler);
now i want to implement my responsehandler. so that i can fetch the status code of my response. I am only interested in status code i.e. 200, 404, 403 and then i want to send this response as int value back
something like
public class MyResponseHandler implements ResponseHandler<Integer> {
public Integer handleResponse(HttpResponse respons) throws ClientProtocolException, IOException {
// TODO Auto-generated method stub
return 0;
}
Now the problem is, i don’t see any response.getStatusCode() method in response object. How to get the status code of my WS call?
Use
response.getStatusLine().getStatusCode().HttpResponse#getStatusLine()StatusLine#getStatusCode()