Я создал действие 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
}
}
Какой код для этого?