gpt4 book ai didi

grails - Grails筛选器-访问servletRequest和ServletResponse

转载 作者:行者123 更新时间:2023-12-02 14:21:00 26 4
gpt4 key购买 nike

从Grails过滤器访问ServletRequest和ServletResponse的正确方法是什么?

由于生成器语法的原因,不确定将这些内容传递到何处。

def filters = {

all(controller:"*", action:"*") {
before = {


}
}
}

最佳答案

在手册中:更新:7.2.1.1 Variables and Scopes

Filters support all the common properties available to controllers and tag libraries, plus the application context:

  • request - The HttpServletRequest object
  • response - The HttpServletResponse object


因此,只需在闭包中使用 requestresponse

关于grails - Grails筛选器-访问servletRequest和ServletResponse,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8597607/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com