[ACCEPTED]-How can I get the actual error behind HttpResponseException?-post
Why do you use BasicResponseHandler()? The 5 handler is doing that for you. That handler 4 is just an example and shouldn't be used 3 in real code.
You should either write your 2 own handler or call execute without a handler.
For 1 example,
HttpResponse response = httpClient.execute(request);
int statusCode = response.getStatusLine().getStatusCode();
HttpEntity entity = response.getEntity();
responseBody = entity.getContent();
if (statusCode != 200) {
// responseBody will have the error response
}
responseBody will always be null if an exception 8 is thrown while assigning a value to it.
besides 7 that it's specific behaviour of the implementation 6 - ie Apache HttpClient.
It looks like it 5 doesn't maintain any of the detailed information 4 in the exception (obviously).
I'd load up 3 the source code for HttpClient and debug 2 that.
but first check if there's anything 1 in the e.getCause()...
hope that helps.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.