我想在将请求分派(dispatch)到操作之前执行业务逻辑。
这是我的代码:
public class Global extends GlobalSettings {
public Action onRequest(Http.Request request, Method actionMethod){
System.out.println("before each request..." + request.toString());
return super.onRequest(request, actionMethod);
}
}
但是它不起作用。
最佳答案
作为远离全局状态的一部分,Play 2.5 中已弃用 Global
的使用。
改用过滤器。您可以在documentation中找到详细的分割。 .
关于java - onRequest() 在 Play 中不起作用!框架2.5.x,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41955613/