Пример #1
0
 @RequestMapping(value = "users", method = RequestMethod.POST)
 public ResponseEntity<?> add(@RequestBody User user) throws SQLException, UnAuthorizedException {
   if (StringUtils.isEmpty(user.getName()) || StringUtils.isEmpty(user.getSex())) {
     throw UnAuthorizedException.newInstance();
   }
   userService.add(user);
   return ResponseEntity.ok().build();
 }
Пример #2
0
 @RequestMapping(value = "users", method = RequestMethod.PUT)
 public ResponseEntity<?> update(@RequestBody User user)
     throws UnAuthorizedException, SQLException {
   userService.update(user);
   return ResponseEntity.ok().build();
 }
Пример #3
0
 @RequestMapping(value = "users", method = RequestMethod.GET)
 public List<User> getAll() throws IOException, SQLException {
   return userService.getAll();
 }