(Quick Reference)

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 class

grails create-middleware com.myapp.MyMiddleware

Implement it's behaviour

package com.myapp

class 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) } }

And register it in the Config file

            - com.myapp.MyMiddleware