简体   繁体   中英

Grails Filter - Getting access to the servletRequest and servletResponse

What is the proper way to get access to the servletRequest and servletResponse from a Grails Filter.

Not sure where these get passed in due to the builder syntax.

def filters = {

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


        }
    }
}

It's in the manual: UPDATED: 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

So just use request and response in your closures.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM