(Quick Reference)

request

Purpose

The request object is an instance of the Servlet API’s {jakartaee}jakarta/servlet/http/HttpServletRequest.html[HttpServletRequest] class.

Examples

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

        render(view: actionName)
    }
}

Description

The {jakartaee}jakarta/servlet/http/HttpServletRequest.html[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.

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