(Quick Reference)

request

Purpose

The {grailsdocs}ref/Servlet%20API/request.html[request] object is an instance of the Servlet API’s {javaee}javax/servlet/http/HttpServletRequest.html[HttpServletRequest] class

Examples

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

        render(view: actionName)
    }
}

Description

The {javaee}javax/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 {grailsdocs}ref/Servlet%20API/request.html[request] object are documented in the Grails Servlet API reference guide