Exclude Grails Filter from 2 (or more) controllers

I have a Grails filter that I want to execute for every controller except 2 ( SimpleCaptchaController and ApiController ). I looked at Grails docs that describe how to determine which controllers / actions / views a filter should apply, and doesnโ€™t exist. It seems like the 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 to you that you are not allowed to use controller and api together.

+4
source share
1 answer

Have you tried a simple regex:

 allExceptTwo(controller: 'simpleCaptcha|api', invert: true) 

I have done something similar before and it works.

Note. I think stopping the restart of the application is necessary to make changes to the filters.

+9
source

Source: https://habr.com/ru/post/1486692/


All Articles