在这里,我将呼叫重定向到Facebook登录页面,该页面返回为' play.mvc.Result'对象,但我要求' play.twirl.api.Html'
public class SecureSocialTemplatesPlugin implements ViewTemplates {
@Override
public Html getLoginPage(Form<Tuple2<String, String>> arg0, Option<String> arg1, RequestHeader arg2, Lang arg3) {
play.mvc.Results.redirect("/auth/authenticate/facebook");//Issue here is this call returns play.mvc.Result object but I require Html
return sociallogin.render(socialSite);
}
}
如何从重定向呼叫响应生成html响应?
答案 0 :(得分:0)
你做错了,你应该返回Result(对于每个Play动作 - 实际上redirect(...)也是结果),所以它应该是:
public Html getLoginPage(Form<Tuple2<String, String>> arg0, Option<String> arg1, RequestHeader arg2, Lang arg3) {
// ...
return play.mvc.Results.redirect("/auth/authenticate/facebook");
}