예제 #1
0
 @GET
 @Path("{id}")
 @Produces(MediaType.APPLICATION_JSON)
 public User get(@PathParam("id") String id) throws ApplicationException {
   System.out.println("GET get : " + id);
   return userBean.getUser(id);
 }
예제 #2
0
 @POST
 @Path("/update")
 @Consumes(MediaType.APPLICATION_JSON)
 public String update(User data) throws ApplicationException {
   System.out.println("POST update : " + data);
   userBean.updateUser(data);
   return "Updated User";
 }
예제 #3
0
 @POST
 @Path("/add")
 @Consumes(MediaType.APPLICATION_JSON)
 public String add(User data) throws ApplicationException {
   System.out.println("POST add : " + data);
   userBean.addUser(data);
   return "Added User";
 }
예제 #4
0
 @DELETE
 @Path("{id}")
 public String delete(@PathParam("id") String id) {
   try {
     userBean.deleteUser(id);
     return "Removed User with id : " + id;
   } catch (Exception e) {
     System.err.println("[UserResource] error");
     return "Error removing User with id : " + id;
   }
 }
예제 #5
0
 @GET
 @Path("/list")
 @Produces(MediaType.APPLICATION_JSON)
 public List<User> getAll() throws ApplicationException {
   return userBean.getAllUsers();
 }