I am while using
org.apache.http.HttpResponse class during my Java application, and I have to have the ability to obtain the HTTP status code. Basically used
.toString() onto it, I can tell the HTTP status code inside. Can there be every other function will be able to just obtain the HTTP status code as either an int or String?
Thanks a lot!
Use [cde], which returns a
HttpResponse.getStatusLine() object that contains the status code, protocol version and "reason".
There is a well recorded answer here...
Searching in the documentation for HttpResponse, there is not any method of getting the integer HTTP code. To be able to obtain the integer code it's important to parse a string! (This appears really short-on the sides in my experience and I'd like a reason why it had been done by doing this!)