Esempio n. 1
0
 @GET
 @Path("/addresses")
 @Produces({MediaType.APPLICATION_JSON})
 public String[] getAddresses() throws ClassNotFoundException {
   ResponseBuilder response = Response.status(200);
   System.out.println("im in get 12343r245");
   Neo4jAdapter neo = Neo4jAdapter.getInstance();
   neo.open();
   String[] res = neo.getAdresses();
   neo.close();
   return res;
 }
Esempio n. 2
0
 @Path("/person")
 @Consumes(MediaType.APPLICATION_JSON)
 @Produces({MediaType.APPLICATION_JSON})
 @POST
 public Response createPerson(String json) {
   ResponseBuilder response = Response.status(200);
   User jsonUser = new Gson().fromJson(json, User.class);
   Neo4jAdapter neo = Neo4jAdapter.getInstance();
   neo.open();
   neo.createPerson(jsonUser);
   neo.close();
   JsonObject jsonObj = new JsonObject();
   jsonObj.addProperty("success", true);
   response.entity(jsonObj.toString());
   return response.build();
 }