func InterceptFunc(intc InterceptorFunc, when When, target interface{})
Install a general interceptor. This can be applied to any Controller. It must have the signature of:
func example(c *revel.Controller) revel.Result
func InterceptMethod(intc InterceptorMethod, when When)
Install an interceptor method that applies to its own Controller.
func (c AppController) example() revel.Result func (c *AppController) example() revel.Result
func InterceptorFilter(c *Controller, fc []Filter)
type InterceptTarget int
const ( ALL_CONTROLLERS InterceptTarget = iota )
type Interception struct { When When // contains filtered or unexported fields }
func (i Interception) Invoke(val reflect.Value) reflect.Value
Perform the given interception. val is a pointer to the App Controller.
type InterceptorFunc func(*Controller) Result
An "interceptor" is functionality invoked by the framework BEFORE or AFTER an action.
An interceptor may optionally return a Result (instead of nil). Depending on when the interceptor was invoked, the response is different: 1. BEFORE: No further interceptors are invoked, and neither is the action. 2. AFTER: Further interceptors are still run. In all cases, any returned Result will take the place of any existing Result.
In the BEFORE case, that returned Result is guaranteed to be final, while in the AFTER case it is possible that a further interceptor could emit its own Result.
Interceptors are called in the order that they are added.
***
Two types of interceptors are provided: Funcs and Methods
Func Interceptors may apply to any / all Controllers.
func example(*revel.Controller) revel.Result
Method Interceptors are provided so that properties can be set on application controllers.
func (c AppController) example() revel.Result func (c *AppController) example() revel.Result
type InterceptorMethod interface{}
type When int
const ( BEFORE When = iota AFTER PANIC FINALLY )