@RequestMapping(value = "/add", method = RequestMethod.POST) @ResponseBody public String add(HttpServletResponse response, Principal principal, @RequestParam int points) throws IOException { User user = userService.getUserByPseudo(principal.getName()); user.setPoints(user.getPoints() + points); userService.updateUserByAdmin(user); return "" + user.getPoints(); }
@RequestMapping(value = "/getPoints", method = RequestMethod.GET) @ResponseBody public String getPoints(HttpServletResponse response, Principal principal) throws IOException { User user = userService.getUserByPseudo(principal.getName()); return "" + user.getPoints(); }