Using the Apache http commons code, the call:
CloseableHttpResponse response = httpclient.execute(target, httpget, localContext);
returns a response object which has a response.getStatusLine()
method that returns a String that includes the response code. But no method to get the response code as an int.
How can I get the response code? Parsing the string strikes me as fragile as there might be a message with other numbers in it.
thanks - dave
From the
StatusLine
, you can callgetStatusCode()
: