From: Kai Moritz Date: Thu, 21 Jan 2016 15:58:46 +0000 (+0100) Subject: Added a second page to proof, that the connection is persisted X-Git-Tag: part-00~1 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=11bd1660100f320d039dbcf9197e98b360b4daa0;p=examples%2Ffacebook-app Added a second page to proof, that the connection is persisted --- diff --git a/src/main/java/de/juplo/yourshouter/ProfileController.java b/src/main/java/de/juplo/yourshouter/ProfileController.java new file mode 100644 index 0000000..35cadc8 --- /dev/null +++ b/src/main/java/de/juplo/yourshouter/ProfileController.java @@ -0,0 +1,36 @@ +package de.juplo.yourshouter; + +import javax.inject.Inject; + +import org.springframework.social.facebook.api.Facebook; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + + +/** + * Controller, that handles requests to the root of the application. + * + * @author Kai Moritz + */ +@Controller +public class ProfileController +{ + private final Facebook facebook; + + + @Inject + public ProfileController(Facebook facebook) + { + this.facebook = facebook; + } + + + @RequestMapping(value = "/profile.html", method = RequestMethod.GET) + public String show(Model model) + { + model.addAttribute("profile", facebook.userOperations().getUserProfile()); + return "profile"; + } +} diff --git a/src/main/resources/templates/home.html b/src/main/resources/templates/home.html index 04d9d8a..b4d0074 100644 --- a/src/main/resources/templates/home.html +++ b/src/main/resources/templates/home.html @@ -7,6 +7,7 @@

Hello, Some User!

diff --git a/src/main/resources/templates/profile.html b/src/main/resources/templates/profile.html new file mode 100644 index 0000000..f0b3dab --- /dev/null +++ b/src/main/resources/templates/profile.html @@ -0,0 +1,20 @@ + + + + Hello Facebook + + +

Back HOME

+
+

Public available profile-data

+ + +