I have a Grails filter that I want to execute for every controller except 2 (SimpleCaptchaController
and ApiController
). I've been looking at the Grails docs that describe how to define which controllers/actions/views a filter should be applied to, and there doesn't seem to be any obvious way to exclude a filter from 2 or more controllers.
I tried the following:
allExceptTwo(controller: 'simpleCaptcha', uri: '/api/**', invert: true)
But it seems you're not allowed to use controller
and api
together.
Have you tried a simple regex like this:
allExceptTwo(controller: 'simpleCaptcha|api', invert: true)
I've done something like this before and it works.
Note: I think stop-restart of app is necessary for changes to filters to get picked up.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With