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;
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;
}
@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<String, ?> model,
+ HttpServletRequest request,
+ HttpServletResponse response
+ )
+ throws
+ Exception
+ {
+ PrintWriter writer = response.getWriter();
+ writer.write("<script>");
+ writer.write("top.location.href='");
+ writer.write(redirect.getUrl());
+ writer.write("';");
+ writer.write("</script>");
+ response.flushBuffer();
+ }
+ };
}
@Override