Answers for "online java http request demo"

0

online java http request demo

public void get(String uri) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest request = HttpRequest.newBuilder()
          .uri(URI.create(uri))
          .build();

    HttpResponse<String> response =
          client.send(request, BodyHandlers.ofString());

    System.out.println(response.body());
}
Posted by: Guest on March-18-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language