Beispiel #1
0
 @RequestMapping(value = "/{id}", method = RequestMethod.PUT)
 public @ResponseBody String update(@PathVariable("id") Long id, @RequestBody Message e) {
   if (dao.exists(id)) {
     dao.save(e);
     return "200 OK";
   } else {
     return create(e);
   }
 }
Beispiel #2
0
 @RequestMapping(method = RequestMethod.POST)
 public @ResponseBody String create(@RequestBody Message e) {
   try {
     dao.save(e);
   } catch (Exception ex) {
     return "Failed: " + ex.getMessage();
   }
   return "200 OK";
 }