如何在Grails 2过滤器中定义多个不同的控制器? [英] How to define multiple distinct controllers in Grails 2 filter?

查看:104
本文介绍了如何在Grails 2过滤器中定义多个不同的控制器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Grails 2 Web应用程序过滤器中定义多个不同的控制器?例如,如下所示:

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: '*') {
        ...
    }
}

否则,是否有一种方法可以指定不在过滤器中包含主index.gsp?

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

推荐答案

使用管道符号:

Use the pipe symbol:

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

这篇关于如何在Grails 2过滤器中定义多个不同的控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆