private String requestWebPage ( URL url ) throws FanartTvException { try { HttpGet httpGet = new HttpGet ( url . toURI ( ) ) ; httpGet . addHeader ( "accept" , "application/json" ) ; final DigestedResponse response = DigestedResponseReader . requestContent ( httpClient , httpGet , charset ) ; if ( response . getStatusCode ( ) >= 500 ) { throw new FanartTvException ( ApiExceptionType . HTTP_503_ERROR , response . getContent ( ) , response . getStatusCode ( ) , url ) ; } else if ( response . getStatusCode ( ) >= 300 ) { throw new FanartTvException ( ApiExceptionType . HTTP_404_ERROR , response . getContent ( ) , response . getStatusCode ( ) , url ) ; } return response . getContent ( ) ; } catch ( URISyntaxException ex ) { throw new FanartTvException ( ApiExceptionType . CONNECTION_ERROR , "Invalid URL" , url , ex ) ; } catch ( IOException ex ) { throw new FanartTvException ( ApiExceptionType . CONNECTION_ERROR , "Error retrieving URL" , url , ex ) ; } }
Download the URL into a String