Using Apache HttpClient 4.1.3 and trying to get the status code from an HttpGet
:
HttpClient client = new DefaultHttpClient();
HttpGet response = new HttpGet("http://www.example.com");
ResponseHandler<String> handler = new BasicResponseHandler();
String body = client.execute(response, handler);
How do I extract the status code (202, 404, etc.) from the body
? Or, if there's another way to do this in 4.1.3, what is it?
Also, I assume a perfect/good HTTP response is an HttpStatus.SC_ACCEPTED
but would like confirmation on that as well. Thanks in advance!