【发布时间】:2013-11-20 10:21:50
【问题描述】:
我创建了带有action composition 的操作 OnlyOwner,它获取了两个用户并且必须将他们返回给控制器。 这里的代码解释:
控制器
@With(OnlyOwner.class) // Call to the action
public static Result profile(Long id) {
return ok(profile.render(user, userLogged));
}
动作
public class OnlyOwner extends Action.Simple{
@Override
public Promise<SimpleResult> call(Http.Context ctx) throws Throwable {
// Here I'm trying to get the Long id passed to che controller
Long id = (Long)ctx.args.get("id"); // but this retrieves a null
User user = User.findById(id);
User userLogged = // Here I get another user
// Now I want to return both the users to the controller
}
}
执行此操作的代码是什么?
【问题讨论】:
标签: java playframework action playframework-2.2