Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
0
 /**
  * shows the account page of the logged in user.
  *
  * @param principal
  * @return the account page or the homepage
  */
 @RequestMapping(value = "", method = RequestMethod.GET)
 public ModelAndView showAccountPage(Principal principal) {
   Authentication auth = SecurityContextHolder.getContext().getAuthentication();
   if (principal != null) {
     return accountService.createViewForAccount(auth.getName());
   }
   ModelAndView view = new ModelAndView();
   view.setViewName("redirect:/");
   return view;
 }