在2个动作之前,使Interceptor处于Grails。

我们可以在Grails控制器的beforeInterceptor中定义2个不同的动作吗?我有一个下面的beforeInterceptor控制器:
def beforeInterceptor = [action:this.&debug]

def trimParams() {
    params?.each { it = it.toString().trim() }
}
def debug() {
    log.info(\"${actionUri} with params ${params}\")
}
如何将\'trimParams \'操作与\'debug \'操作一起添加到拦截器?我不知道确切的语法。非常感谢。     
已邀请:
        我建议您为拦截器定义一个单独的操作:
def beforeInterceptor = [action:this.&doBeforeStuff]

def doBeforeStuff() {
    trimParams(params)
    debug(params)
}

def trimParams() {
    params?.each { it = it.toString().trim() }
}
def debug() {
    log.info(\"${actionUri} with params ${params}\")
}
我没有尝试过,但可能会有所帮助。     

要回复问题请先登录注册