Get HTTP code from org.apache.http.HttpResponse Get HTTP code from org.apache.http.HttpResponse apache apache

Get HTTP code from org.apache.http.HttpResponse


Use HttpResponse.getStatusLine(), which returns a StatusLine object containing the status code, protocol version and "reason".


I have used httpResponse.getStatusLine().getStatusCode() and have found this to reliably return the integer http status code.


httpResponse.getStatusLine().getStatusCode()