samu_masken #9

Merged
PBG2H22AWO merged 4 commits from samu_masken into master 2023-12-20 09:56:32 +01:00
2 changed files with 10 additions and 2 deletions
Showing only changes of commit bf9c99672d - Show all commits

View File

@ -5,6 +5,10 @@ import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.nio.file.WatchEvent;
import Logik.Kind;
import com.google.gson.Gson;
/**
* noch nicht getestet
@ -25,7 +29,7 @@ public class RestApiClient implements IRestAPI{
public static void main(String[] args){
new RestApiClient().get("Kind", 2);
new RestApiClient().get("Kind", 1);
}
@ -45,9 +49,12 @@ public class RestApiClient implements IRestAPI{
// Send the request and get the response
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
Gson gson = new Gson();
Kind test = gson.fromJson(httpResponse.body(), Kind.class);
// Print the response status code and body
System.out.println("Status Code: " + httpResponse.statusCode());
System.out.println("Response Body: " + httpResponse.body());
System.out.println("Response Body: " + test.getName());
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -2,6 +2,7 @@ module de.subway_surfers.vpr_app {
requires javafx.controls;
requires javafx.fxml;
requires java.net.http;
requires com.google.gson;
opens de.subway_surfers.vpr_app to javafx.fxml;