如何在 Play 2 控制器上创建非动作函数?有什么方法可以为控制器创建实用程序功能吗?
public class Register extends Controller {
@BodyParser.Of(BodyParser.FormUrlEncoded.class)
public static Result registerByForm() {
.......
}
// this is utility function
private static User getFacebookIdByToken(String fbToken) {
FacebookClient facebookClient = new DefaultFacebookClient(fbToken);
User user = facebookClient.fetchObject("me", User.class);
return user;
}
}