class BookController {
def list() {
log.info "User agent: ${request.getHeader("User-Agent")}"
render(view: actionName)
}
}
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
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.
The additional methods added to the {grailsdocs}ref/Servlet%20API/request.html[request] object are documented in the Grails Servlet API reference guide |