@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); }
@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()); }
@RequestMapping(value = "", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @ResponseBody public Collection<UserForm> getUsers() { return userService.findAll(new UserForm()); }