Esempio n. 1
0
 /**
  * Add new note.
  *
  * @param user
  * @param id
  * @param data
  * @return an instance of javax.ws.rs.core.Response
  */
 @POST
 @Consumes("*/*")
 public Response addNote(@PathParam("user") String user, @PathParam("id") int id, String data) {
   Response r = null;
   if (userAuth.Auth(hh, user)) {
     try {
       r =
           Response.ok()
               .contentLocation(new URI("/" + user + "/note/" + ndb.addNote(user, data)))
               .build();
     } catch (URISyntaxException ex) {
       ex.printStackTrace();
     }
   } else {
     r = unAuthorized();
   }
   return r;
 }