diff --git a/src/main/java/org/example/tampoposerverdtram/resources/DeletedFriendPair.java b/src/main/java/org/example/tampoposerverdtram/resources/DeletedFriendPair.java index 3c02b27..757bc8e 100644 --- a/src/main/java/org/example/tampoposerverdtram/resources/DeletedFriendPair.java +++ b/src/main/java/org/example/tampoposerverdtram/resources/DeletedFriendPair.java @@ -27,17 +27,11 @@ temp_json0.put("user0Id", user0Id); temp_json0.put("user1Id", user1Id); this.value = temp_json0; + String result = client.target("http://localhost:8080").path("/users/"+user0Id+"/friends").queryParam("deletedFriendPair", this.value.toString()).request().delete(String.class); + result = client.target("http://localhost:8080").path("/users/"+user1Id+"/friends").queryParam("deletedFriendPair", this.value.toString()).request().delete(String.class); Form form = new Form(); form.param("deletedFriendPair", this.value.toString()); Entity
entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED); - String result = client.target("http://localhost:8080").path("/users/"+user0Id+"/friends").request().post(entity, String.class); - form = new Form(); - form.param("deletedFriendPair", this.value.toString()); - entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED); - result = client.target("http://localhost:8080").path("/users/"+user1Id+"/friends").request().post(entity, String.class); - form = new Form(); - form.param("deletedFriendPair", this.value.toString()); - entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED); result = client.target("http://localhost:8080").path("/friends/users").request().post(entity, String.class); result = client.target("http://localhost:8080").path("/friends/pairs").queryParam("deletedFriendPair", this.value.toString()).request().delete(String.class); } diff --git a/src/main/java/org/example/tampoposerverdtram/resources/Pairs.java b/src/main/java/org/example/tampoposerverdtram/resources/Pairs.java index b55f576..aa2b07d 100644 --- a/src/main/java/org/example/tampoposerverdtram/resources/Pairs.java +++ b/src/main/java/org/example/tampoposerverdtram/resources/Pairs.java @@ -3,6 +3,8 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import jakarta.ws.rs.client.*; +import jakarta.ws.rs.core.Form; +import jakarta.ws.rs.core.MediaType; import java.util.*; @@ -49,5 +51,20 @@ temp_if42 = temp_if41; } this.value = temp_if42; + Form form = new Form(); + form.param("pid", pairId); + form.param("pair", getPair(pairId).getValue().toString()); + Entity entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED); + String result = client.target("http://localhost:8080").path("/users/"+user0Id+"/friends").request().post(entity, String.class); + form = new Form(); + form.param("pid", pairId); + form.param("pair", getPair(pairId).getValue().toString()); + entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED); + result = client.target("http://localhost:8080").path("/users/"+user1Id+"/friends").request().post(entity, String.class); + form = new Form(); + form.param("pid", pairId); + form.param("pair", getPair(pairId).getValue().toString()); + entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED); + result = client.target("http://localhost:8080").path("/pairId").request().post(entity, String.class); } } \ No newline at end of file