@groovy.transform.CompileStatic trait Interceptor
An interceptor can be used to interceptor requests to controllers and URIs They replace the notion of filters from earlier versions of Grails, prior to Grails 3.0
Type | Name and description |
---|---|
boolean |
after() Executed after the action executes but prior to view rendering |
void |
afterView() Executed after view rendering completes |
boolean |
before() Executed before a matched action |
boolean |
doesMatch() @return Whether the current interceptor does match |
boolean |
doesMatch(javax.servlet.http.HttpServletRequest request) @return Whether the current interceptor does match |
java.util.Map<java.lang.String, java.lang.Object> |
getModel() @return The current model |
java.lang.Throwable |
getThrowable() Obtains the exception thrown by an action execution |
java.lang.String |
getView() @return The current view |
void |
header(java.lang.String headerName, java.lang.Object headerValue) Sets a response header for the given name and value |
Matcher |
match(java.util.Map arguments) Used to define a match. |
Matcher |
matchAll() Matches all requests |
void |
setModel(java.util.Map<java.lang.String, java.lang.Object> model) Sets the model |
void |
setView(java.lang.String view) Sets the view name |
The matchers defined by this interceptor
The order the interceptor should execute in
Executed after the action executes but prior to view rendering
Executed after view rendering completes
t
- The exception instance if an exception was thrown, null otherwiseExecuted before a matched action
Obtains the exception thrown by an action execution
t
- The exception or null if none was thrown
Sets a response header for the given name and value
headerName
- The header nameheaderValue
- The header valueUsed to define a match. Example: match(controller:'book', action:'*')
arguments
- The match argumentsMatches all requests
Sets the model
model
- The model to setSets the view name
view
- The name of the view