简体   繁体   English

将OpenID支持添加到Play Framework应用程序时如何调用absoluteURL()?

[英]How to call absoluteURL() when adding OpenID support to a Play Framework application?

I am attempting to add OpenID login support to a Play Framework application using the sample code on the documentation page : 我正在尝试使用文档页面示例代码将OpenID登录支持添加到Play Framework应用程序:

Map<String, String> attributes = new HashMap<String, String>();
attributes.put("email", "http://schema.openid.net/contact/email");
OpenID.redirectURL(
  openid, 
  routes.Application.openIDCallback.absoluteURL(), 
  attributes
);

The problem is that when I use this code, I get the following compilation error: 问题是,当我使用此代码时,出现以下编译错误:

cannot find symbol [symbol: method absoluteURL()] [location: class play.api.mvc.Call]

Indeed, there isn't a no-argument absoluteURL() method of the Call class; 确实,没有Call类的无参数absoluteURL()方法。 the Call#absoluteURL() methods are: Call#absoluteURL()方法为:

absoluteURL(Http.Request request)

and: 和:

absoluteURL(Http.Request request, boolean secure)

What Http.Request instance do I need to use? 我需要使用哪个Http.Request实例? What is the significance of the secure parameter? secure参数的意义是什么?

Try with the current request: 尝试使用当前请求:

Map<String, String> attributes = new HashMap<String, String>();
attributes.put("email", "http://schema.openid.net/contact/email");
OpenID.redirectURL(
  openid, 
  routes.Application.openIDCallback.absoluteURL(request()), 
  attributes
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM