1
我想在我的Grails應用程序中創建一個AuthorizationFilter
,它將檢查請求參數並確定用戶是否有權處理請求。我希望我可以從我的AuthorizationFilter
內引發自定義異常,後來通過的路線Grails的聲明execption處理像處理:Grails是否允許使用過濾器進行聲明式異常處理?
"403"(controller: 'error', action: 'status403', exception:AuthException)
...但原來當我嘗試這個Grails的2.2.4(和最新的開發快照)我得到
java.lang.IllegalArgumentException: Method name must not be null
at grails.plugin.cache.web.ProxyAwareMixedGrailsControllerHelper.retrieveAction(ProxyAwareMixedGrailsControllerHelper.java:41)
所以...有沒有什麼好的方法來使用聲明式異常處理和過濾器?
快速提示:如果您正在修改UrlMappings,那麼首選一個grails clean然後run-app。我現在再次測試了實現,並且它按預期工作。如果需要,我可以分享項目/代碼。 – dmahapatro