I’m using the org.apache.http.HttpResponse class in my Java application, and I need to be able to get the HTTP status code. If I used .toString() on it, I can see the HTTP status code in there. Is there any other function that I can just get the HTTP status code as either an int or String?
Thanks a bunch!
Use
HttpResponse.getStatusLine(), which returns aStatusLineobject containing the status code, protocol version and “reason”.