static void main(String... args) throws Exception { System.setProperty("jdk.httpclient.HttpClient.log", "requests, headers"); var uri= URI.create("https://airhacks.live"); var client = HttpClient.newHttpClient(); var request = HttpRequest .newBuilder(uri) .GET() .build(); var response = client.send(request, BodyHandlers.discarding()); System.out.println(response.statusCode()); } |
siehe auch: JavaDoc HttpClient