update rest
This commit is contained in:
8
.idea/.gitignore
generated
vendored
8
.idea/.gitignore
generated
vendored
@@ -1,8 +0,0 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"java.configuration.updateBuildConfiguration": "interactive"
|
||||
}
|
||||
8
pom.xml
8
pom.xml
@@ -38,7 +38,6 @@
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
<version>${servlet.api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Jersey -->
|
||||
@@ -97,6 +96,13 @@
|
||||
<version>4.0.5</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Client -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.core</groupId>
|
||||
<artifactId>jersey-client</artifactId>
|
||||
<version>3.1.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.persistence</groupId>
|
||||
<artifactId>org.eclipse.persistence.moxy</artifactId>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package test;
|
||||
package client.test;
|
||||
|
||||
|
||||
import fr.istic.servlet.HelloServlet.*;
|
||||
import jakarta.ws.rs.client.Client;
|
||||
import jakarta.ws.rs.client.ClientBuilder;
|
||||
import jakarta.ws.rs.client.Entity;
|
||||
@@ -27,9 +28,17 @@ public class TestApi {
|
||||
public static void main(String[] args) {
|
||||
Client client = ClientBuilder.newClient();
|
||||
|
||||
SomeMessage serverResponse = client.target(URL).path("hello").path("Bob")
|
||||
.request(MediaType.APPLICATION_JSON_TYPE).get(SomeMessage.class);
|
||||
System.out.println(serverResponse.greetings + " " + serverResponse.name);
|
||||
|
||||
|
||||
//Supprimez cette ligne quand vous ferez le client :
|
||||
System.exit(0);
|
||||
|
||||
//Post a message :
|
||||
ChatMessage m = new ChatMessage();
|
||||
m.content="test";
|
||||
m.content= "client/test";
|
||||
Response response = client.target(URL).path("messages").request(MediaType.APPLICATION_JSON_TYPE).post(Entity.entity(m, MediaType.APPLICATION_XML));
|
||||
System.out.println("Response "+ response.getStatus());
|
||||
|
||||
Reference in New Issue
Block a user