コード例 #1
0
 @RequestMapping(value = "/profile", method = RequestMethod.POST)
 @ResponseStatus(HttpStatus.OK)
 public void updateProfile(UserForm form) {
   User user = userService.findOne(SecurityUtils.getCurrentUserId());
   user.setFirstName(form.getFirstName());
   user.setLastName(form.getLastName());
   user.setEmail(form.getEmail());
   userService.save(user);
   SecurityUtils.updateCurrentUser(user);
 }
コード例 #2
0
 @RequestMapping(method = RequestMethod.POST)
 @ResponseStatus(HttpStatus.CREATED)
 public void signup(
     @Validated({Default.class, AddMode.class}) User user,
     @RequestParam(required = false) String image,
     BindingResult formBinding,
     HttpServletResponse response)
     throws IOException {
   if (formBinding.hasErrors()) {
     return;
   }
   if (image != null) {
     user.setAvatar(documentService.saveBase64DecodeImage("userimage.jpg", image, "image/jpeg"));
   }
   user = userService.signup(user);
   response.addHeader("Location", user.getId().toString());
 }
コード例 #3
0
 @RequestMapping(value = "", method = RequestMethod.GET)
 @ResponseStatus(HttpStatus.OK)
 @ResponseBody
 public Collection<UserForm> getUsers() {
   return userService.findAll(new UserForm());
 }