|
|
|
|
|
by pcdavid
1563 days ago
|
|
This is not representattive of modern Java, which has much better APIs. Since Java 11: public HttpResponse<String> fetch(String url) {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder(URI.create(url)).build();
return client.send(request, BodyHandlers.ofString());
}
|
|