簡體   English   中英

onRequest()在Play中不起作用! 框架2.5.x

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

我想在將請求分派到操作之前執行業務邏輯。

這是我的代碼:

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 ,因為它是遠離global狀態的一部分。

請改用過濾器。 您可以在文檔中找到詳細的細分。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM