@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(); }
@RequestMapping(value = "users", method = RequestMethod.PUT) public ResponseEntity<?> update(@RequestBody User user) throws UnAuthorizedException, SQLException { userService.update(user); return ResponseEntity.ok().build(); }
@RequestMapping(value = "users", method = RequestMethod.GET) public List<User> getAll() throws IOException, SQLException { return userService.getAll(); }