(Quick Reference)

request

Purpose

The request object is an instance of the Servlet API’s HttpServletRequest class.

Examples

class BookController {
    def list() {
        log.info "User agent: ${request.getHeader("User-Agent")}"

        render(view: actionName)
    }
}

Description

The HttpServletRequest class is useful for, amongst other things, obtaining request headers, storing request scoped attributes and establishing information about the client. Refer to the Servlet API’s javadocs for further information.

The additional methods added to the request object are documented in the Grails Servlet API reference guide