@RequestMapping(method = RequestMethod.GET)
public String home(Model model)
{
- boolean authorized = true;
- try
- {
- authorized = facebook.isAuthorized();
- }
- catch (NullPointerException e)
- {
- LOG.debug("NPE while acessing Facebook: {}", e);
- authorized = false;
- }
- if (!authorized)
- {
- LOG.info("no authorized user, redirecting to /signin.html");
- return "redirect:/signin.html";
- }
-
User user = facebook.userOperations().getUserProfile();
LOG.info("authorized user {}, id: {}", user.getName(), user.getId());
model.addAttribute("user", user);