1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
package API;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.neo4j.graphdb.Node;
import function.query.weceipt.GraphManagement;
@Path("/API")
public class MyService {
@POST
@Path("/node")
@Produces({ MediaType.APPLICATION_JSON })
public Node createNode(@DefaultValue("default_id") @QueryParam("ID") String id) {
GraphManagement gm = new GraphManagement();
Node node = gm.createClientNode(id);
return node;
}
@GET
@Path("/node/{ID}")
@Produces({ MediaType.APPLICATION_JSON })
public Node getNode(@PathParam("ID") String id) {
GraphManagement gm = new GraphManagement();
Node node = gm.getClientNode(id);
return node;
}
@Path("/test")
@GET
@Produces(MediaType.TEXT_PLAIN)
public void afficher() {
System.out.println("test");
}
} |