grailsgrails-filters

How to define multiple distinct controllers in Grails 2 filter?


Is it possible to define multiple distinct controller in a Grails 2 web application filter? For example, something like:

def filters = {
    someFilterMethod(controller: 'controller1 controller2 ...', action: '*') {
        ...
    }
}

Otherwise, is there a way to specify to not include the main index.gsp in the filter?


Solution

  • Use the pipe symbol:

    def filters = {
       someFilterMethod(controller: 'controller1|controller2|...', action: '*') {
          ...
       }
    }