String remoteContent(String path) throws IOException { String fullUrl = serverUrl + path; HttpURLConnection conn = newHttpConnection(new URL(fullUrl)); Reader reader = new InputStreamReader((InputStream) conn.getContent()); try { int statusCode = conn.getResponseCode(); if (statusCode != HttpURLConnection.HTTP_OK) { throw new IOException("Status returned by url : '" + fullUrl + "' is invalid : " + statusCode); } return BootstrapperIOUtils.toString(reader); } finally { BootstrapperIOUtils.closeQuietly(reader); conn.disconnect(); } }