/** * Get the response from the URL * * @param url * @return * @throws TrailerAddictException */ private static DigestedResponse getResponse(String url) throws TrailerAddictException { final DigestedResponse response; try { HttpGet httpGet = new HttpGet(url); httpGet.addHeader("accept", "application/xml"); response = DigestedResponseReader.requestContent(HTTP_CLIENT, httpGet, CHARSET); if (response.getStatusCode() >= 500) { throw new TrailerAddictException(ApiExceptionType.HTTP_503_ERROR, url); } else if (response.getStatusCode() >= 300) { throw new TrailerAddictException(ApiExceptionType.HTTP_404_ERROR, url); } } catch (IOException ex) { throw new TrailerAddictException( ApiExceptionType.CONNECTION_ERROR, "Unable to read URL", url, ex); } return response; }