From d8fa29892844f3b86e01b169da5ccf0d03fd5d94 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Thu, 28 Jan 2016 21:05:38 +0100 Subject: [PATCH] WIP: Added a controller, to manage permissions --- .../yourshouter/PermissionsController.java | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/juplo/yourshouter/PermissionsController.java b/src/main/java/de/juplo/yourshouter/PermissionsController.java index e3a9820..1251bda 100644 --- a/src/main/java/de/juplo/yourshouter/PermissionsController.java +++ b/src/main/java/de/juplo/yourshouter/PermissionsController.java @@ -1,7 +1,11 @@ package de.juplo.yourshouter; +import java.io.PrintWriter; import java.util.List; +import java.util.Map; import javax.inject.Inject; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.springframework.social.connect.ConnectionFactoryLocator; import org.springframework.social.connect.ConnectionRepository; import org.springframework.social.connect.web.ConnectController; @@ -13,6 +17,7 @@ import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.servlet.View; import org.springframework.web.servlet.view.RedirectView; @@ -49,9 +54,35 @@ public class PermissionsController extends ConnectController } @RequestMapping(method=RequestMethod.POST) - public RedirectView connect(NativeWebRequest request) + public View connect(NativeWebRequest request) { - return super.connect("facebook", request); + final RedirectView redirect = super.connect("facebook", request); + return new View() + { + @Override + public String getContentType() + { + return "text/html"; + } + + @Override + public void render( + Map model, + HttpServletRequest request, + HttpServletResponse response + ) + throws + Exception + { + PrintWriter writer = response.getWriter(); + writer.write(""); + response.flushBuffer(); + } + }; } @Override -- 2.20.1