Code example for BasicResponseHandler

0
	public static String getContents(URI uri) throws Exception {
 
		if (uri == null) throw new NullPointerException("No URI provided.");
 
		HttpGet httpget = new HttpGet(uri);
		ResponseHandler<String> responseHandler = new BasicResponseHandler();
 
		log.debug("Retrieving from: " + uri);
		String responseBody = httpClient.execute(httpget, responseHandler);
		log.debug("Response size: " + responseBody.length() + " characters.");
 
		return responseBody;
	} 
} 
Experience pair programming with AI  Get Codota for Java