/** * Shows the account page of the given username * * @param username * @return returns the page or a page not found */ @RequestMapping(value = "/{username:.+}", method = RequestMethod.GET) public ModelAndView showPageForUsername(@PathVariable("username") String username) { Account account = accountService.findByUsername(username); if (account != null) { return accountService.createViewForAccount(username); } ModelAndView view = new ModelAndView(); view.setViewName("/pageNotFound"); return view; }
/** * This function returns the edit profile page * * @return */ @RequestMapping(value = "editProfile", method = RequestMethod.GET) public ModelAndView showEditProfilePage() { Authentication auth = SecurityContextHolder.getContext().getAuthentication(); Account account = accountService.findByUsername(auth.getName()); ModelAndView view = new ModelAndView(); if (account != null) { view.addObject("account", account); view.setViewName("editProfile"); return view; } view.setViewName("redirect:/"); return view; }