dotfiles/.config/Code/User/History/-2754a774/PDPl.java
RafayAhmad7548 4f46de8d00 update
2024-09-09 16:59:28 +05:00

30 lines
No EOL
872 B
Java

package com.rutils;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main{
public static void main(String[] args){
HttpsClient client = HttpClient.newHttpClient();
try{
HttpRequest request = HttpRequest.newBuilder().uri(new URI("https://localhost:8000/greet")).build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
catch(URISyntaxException e){
e.printStackTrace();
}
catch (IOException e){
e.printStackTrace();
}
catch (InterruptedException e){
e.printStackTrace();
}
}
}