if (status >= HttpStatus.SC_OK && status < HttpStatus.SC_MULTIPLE_CHOICES) {
return readResponse(response);
} if (status == HttpStatus.SC_UNAUTHORIZED) {
String error = "Unable to perform request. You need to be authenticated.";
logger.log(Level.SEVERE, error);
throw new HttpResponseException(status, error);
} if (status == HttpStatus.SC_BAD_REQUEST) {
String error = "Unable to perform request since this one seems to be bad... ";
logger.log(Level.SEVERE, error);
throw new HttpResponseException(status, error);
} else {
String error = EntityUtils.toString(response.getEntity());
logger.log(Level.SEVERE, "Unexpected response status: {0} - {1}", new Object[]{status, error});
throw new HttpResponseException(status, error);
}
}