1 Introduction - Reference Documentation
Authors: Luís Duarte
Version: 0.0.3
1 Introduction
The Grails middleware plugin provides a convenient DSL to create an HTTP Request/Response Pipeline.All you have to do is create a Middleware classgrails create-middleware com.myapp.MyMiddleware
package com.myappclass MyMiddleware { void processRequest(GrailsWebRequest grailsWebRequest) { grailsWebRequest.request.setAttribute("SomeAttribute", "1234") } void processResponse(GrailsWebRequest grailsWebRequest) { grailsWebRequest.response.setHeader("X-SomeHeader", "Middleware Example") } void processException(GrailsWebRequest grailsWebRequest, Throwable exception) { grailsWebRequest.response.setHeader("X-SomeException", exception.class.simpleName) } }
grails: middleware: order: - com.myapp.MyMiddleware