code: private static String fetchHttpResponse(URL url) throws IOException {
        HttpURLConnection conn = null;
        try {
           logger.info("fetching from url = " + url);
           conn = (HttpURLConnection) url.openConnection();
           int response = conn.getResponseCode();
           if (response != HttpURLConnection.HTTP_ACCEPTED) {
              String responseContent = IOUtils.toString(conn.getInputStream());
              logger.info("responseContent = " + responseContent);
              
              return responseContent;
           }
           throw new IOException("response from service not valid");
        } catch (IOException e) {
           logger.severe("unable to do proper http request url = " + url.toString());
           throw e;
        } finally {
           conn.disconnect();
        }
  
     }
docs: convenience method to do a http request on url, and return result as a string
  
  @param url
  @return
  @throws IOException