[英]Grails 2.4 filters don't seem to be working
I have a Grails 2.4.4 app. 我有一个Grails 2.4.4应用程序。 In it I have the following controllers: 在其中我有以下控制器:
myapp/
grails-app/
controllers/
fizzbuzz/
FizzController.groovy
BuzzController.groovy
... many others, etc.
I want to create Grails Filters for some of these, so I create a grails-app/conf/WidgetFilters.groovy
class: 我想为其中一些创建Grails过滤器 ,所以我创建了一个grails-app/conf/WidgetFilters.groovy
类:
class WidgetFilters {
def filters = {
fizzFilter(controller: 'fizz*', action: '*') {
before = {
println 'I intercepted a called to the Fizz Controller!'
}
}
buzzFilter(controller: 'buzz*', action: '*') {
before = {
println 'I intercepted a called to the Buzz Controller!'
}
}
}
}
When I start my app up and go to any Fizz/Buzz actions, I do not see the println
. 当我启动我的应用程序并进行任何Fizz / Buzz操作时,我看不到println
。 I've also tried other logging statements (SLF4J) and put other code inside the before
closure and am 100% convinced they are not executing. 我还尝试了其他日志语句(SLF4J)并将其他代码置于关闭before
并且100%确信它们没有执行。 Have I done something obviously wrong? 我做过一些明显错误的事吗?
Did you tried to restart app + clean build? 你试过重启app + clean build吗?
I've copy-pasted your filters and mock controllers and they're working, here is a code. 我已经复制粘贴过滤器和模拟控制器,它们正在工作, 这是一个代码。
Please check out also this properties : 请查看此属性 :
将课程移至grails-app/conf
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.