55 lines
1.2 KiB
Java
55 lines
1.2 KiB
Java
package org.gucbe.data.publishing.accounting.service;
|
|
|
|
//import org.junit.Test;
|
|
//import org.slf4j.Logger;
|
|
//import org.slf4j.LoggerFactory;
|
|
|
|
public class JerseyClient {
|
|
|
|
//private static Logger log = LoggerFactory.getLogger(JerseyClient.class);
|
|
|
|
|
|
|
|
|
|
//@Test
|
|
public void Insert() {
|
|
/*
|
|
try {
|
|
|
|
Student st = new Student("Adriana", "Barrer", 12, 9);
|
|
|
|
ClientConfig clientConfig = new DefaultClientConfig();
|
|
|
|
clientConfig.getFeatures().put(
|
|
JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
|
|
|
|
Client client = Client.create(clientConfig);
|
|
|
|
WebResource webResource = client
|
|
.resource("http://localhost:8080/accounting-service/gcube/service/send?gcube-token=3acdde42-6883-4564-b3ba-69f6486f6fe0-98187548");
|
|
|
|
ClientResponse response = webResource.accept("application/json")
|
|
.type("application/json").post(ClientResponse.class, st);
|
|
|
|
if (response.getStatus() != 200) {
|
|
throw new RuntimeException("Failed : HTTP error code : "
|
|
+ response.getStatus());
|
|
}
|
|
|
|
String output = response.getEntity(String.class);
|
|
|
|
System.out.println("Server response .... \n");
|
|
System.out.println(output);
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
}
|