8.5.2 Matching Requests with Inteceptors - Reference Documentation
Authors: Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith, Lari Hotari
Version: 3.1.4
8.5.2 Matching Requests with Inteceptors
As mention in the previous section, by default an interceptor will match only requests to the associated controller by convention. However you can configure the interceptor to match any request using thematch or matchAll methods defined in the Interceptor API.The matching methods return a Matcher instance which can be used to configure how the interceptor matches the request.For example the following interceptor will match all requests except those to the login controller:class AuthInterceptor {
  AuthInterceptor() {
    matchAll()
    .excludes(controller:"login")
  }  boolean before() {
    // perform authentication
  }
}class LoggingInterceptor {
  LoggingInterceptor() {
    match(controller:"book", action:"show") // using strings
    match(controller: ~/(author|publisher)/) // using regex
  }  boolean before() {
    …
  }
}- when the showaction ofBookControlleris called
- when AuthorControllerorPublisherControlleris called
uri accept either a String or a Regex expression. The uri argument supports a String path that is compatible with Spring's AntPathMatcher.  The possible named arguments are:
- namespace- The namespace of the controller
- controller- The name of the controller
- action- The name of the action
- method- The HTTP method
- uri- The URI of the request. If this argument is used then all other arguments will be ignored and only this will be used.
