You can use beforeInterceptor in the controller for exactly the same purpose. Put this in a new controller, say BaseController, and put everything you want to do, and then distribute all existing controllers with BaseController, and you're ready to go. For more information about beforeInterceptor Click here.
Note If you already have a common controller that is expandable by all other controllers, there is no need to implement a new controller. Just implement beforeInterceptor in this same controller.
In addition, you can use the filter and do everything that is in this filter. For more information about filters in Grails, click here.
source share