Added a second page to proof, that the connection is persisted
[examples/facebook-app] / src / main / java / de / juplo / yourshouter / ProfileController.java
1 package de.juplo.yourshouter;
2
3 import javax.inject.Inject;
4
5 import org.springframework.social.facebook.api.Facebook;
6 import org.springframework.stereotype.Controller;
7 import org.springframework.ui.Model;
8 import org.springframework.web.bind.annotation.RequestMapping;
9 import org.springframework.web.bind.annotation.RequestMethod;
10
11
12 /**
13  * Controller, that handles requests to the root of the application.
14  *
15  * @author Kai Moritz
16  */
17 @Controller
18 public class ProfileController
19 {
20   private final Facebook facebook;
21
22
23   @Inject
24   public ProfileController(Facebook facebook)
25   {
26     this.facebook = facebook;
27   }
28
29
30   @RequestMapping(value = "/profile.html", method = RequestMethod.GET)
31   public String show(Model model)
32   {
33     model.addAttribute("profile", facebook.userOperations().getUserProfile());
34     return "profile";
35   }
36 }