Java 重头戏2不在全局的onRequest中调用提供的操作方法

Java 重头戏2不在全局的onRequest中调用提供的操作方法,java,playframework,playframework-2.2,Java,Playframework,Playframework 2.2,我试图调用不同的操作方法,这取决于我在前面的会话中所做的事情。为此,我在全局中重写onRequest方法,就像在中建议的那样。我使用Java反射构造了一个具有相同名称和参数的新方法,但位于不同的类B中。类B和具有原始actionMethod的原始类实现了相同的接口。所以应该没有问题 我在Global中的onRequest如下所示: @Override public Action onRequest(Request request, final Method actionMethod) {

我试图调用不同的操作方法,这取决于我在前面的会话中所做的事情。为此,我在全局中重写onRequest方法,就像在中建议的那样。我使用Java反射构造了一个具有相同名称和参数的新方法,但位于不同的类B中。类B和具有原始actionMethod的原始类实现了相同的接口。所以应该没有问题

我在Global中的onRequest如下所示:

@Override
public Action onRequest(Request request, final Method actionMethod) {
    if (checkSomething) {
        return super.onRequest(request, getNewActionMethod(actionMethod));
    }
    return super.onRequest(request, actionMethod);
}

private Method getNewActionMethod(Method oldActionMethod) {
    String name = oldActionMethod.getName();
    Class<?>[] parameterTypes = oldActionMethod.getParameterTypes();
    Method newActionMethod = null;
    try {
        newActionMethod = B.class.getMethod(name, parameterTypes);
    } catch (NoSuchMethodException | SecurityException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return newActionMethod;
}
这里的问题是,Play忽略了我的新动作方法,一直坚持调用旧的动作方法。我错过什么了吗


我使用的是Play framework 2.2.3。

您是否已将debug设置为确保调用onRequest?你和阿普利修斯在同一个案子里吗?嗨,阿普利修斯!是的,我进行了调试,并调用了onRequest。这不是你提到的问题。