BuddyJoe
BuddyJoe

Reputation: 71161

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 = {


        }
    }
}

Upvotes: 1

Views: 1716

Answers (1)

OverZealous
OverZealous

Reputation: 39580

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.

Upvotes: 4

Related Questions