简体   繁体   中英

onRequest() is not working in Play! framework 2.5.x

I want to execute business logic before a request is dispatched to an action.

This is my code:

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);
    }

}

But it is not working.

The use of Global is deprecated in Play 2.5 as part of the move away from global state.

Use filters instead. You can find a detailed breakdown in the documentation .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM