简体   繁体   English

AfterInterceptor在Grails 3.0.1中不再起作用

[英]AfterInterceptor does not work in Grails 3.0.1 anymore

I noticed that afterinterceptor does not work in Grails 3.0.1 controllers anymore. 我注意到afterinterceptor在Grails 3.0.1控制器中不再起作用。 The same code works in Grails 2.4.4. 相同的代码在Grails 2.4.4中有效。 Here is my controller code: 这是我的控制器代码:

class TestAfterInterceptController {

    def afterInterceptor = { model, modelAndView ->
        println "##################################################"
        println "Current view is ${modelAndView.viewName}"
    }

    def index() {
        println "##################################################"
        render 'Hello world'
    }
}

when I call the controller with http://localhost:8080/testAfterIntercept , it completely ingnores the after interceptor method and it only prints what is in the index() method. 当我使用http:// localhost:8080 / testAfterIntercept调用控制器时,它完全忽略了after拦截器方法,并且仅打印index()方法中的内容。

controller level interceptors have not been implemented in Grails 3.0 since we have the new Interceptor type. 由于我们具有新的Interceptor类型,因此在Grails 3.0中尚未实现控制器级别的拦截Interceptor See http://grails.github.io/grails-doc/latest/guide/theWebLayer.html#interceptors 参见http://grails.github.io/grails-doc/latest/guide/theWebLayer.html#interceptors

If there is enough demand we will restore controller level interceptors. 如果有足够的需求,我们将恢复控制器级别的拦截器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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