mirror of
https://github.com/kataras/iris.git
synced 2025-03-15 05:16:28 +01:00
fix mvc/ideas/1/main.go->AfterActivation
Former-commit-id: bf3d8227793fba76f0f7349d82d1200275ac9147
This commit is contained in:
parent
d5a38a0cd6
commit
4fb46bf1f3
|
@ -147,6 +147,8 @@ func (c *ExampleController) BeforeActivation(b mvc.BeforeActivation) {
|
||||||
b.Handle("GET", "/mypath/{param}", "DoIt", optionalMiddlewareHere...)
|
b.Handle("GET", "/mypath/{param}", "DoIt", optionalMiddlewareHere...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ExampleController) AfterActivation(a mvc.AfterActivation)
|
// After activation, all dependencies are set-ed - so read only access on them
|
||||||
|
// but still possible to add custom controller or simple standard handlers.
|
||||||
|
func (c *ExampleController) AfterActivation(a mvc.AfterActivation) {}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -73,8 +73,8 @@ func (c *TodoController) BeforeActivation(b mvc.BeforeActivation) {
|
||||||
b.Handle("GET", "/custom", "Custom")
|
b.Handle("GET", "/custom", "Custom")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *TodoController) AfterActivation(b mvc.BeforeActivation) {
|
func (c *TodoController) AfterActivation(a mvc.AfterActivation) {
|
||||||
if !b.IsRequestScoped() {
|
if !a.IsRequestScoped() {
|
||||||
panic("TodoController should be request scoped, we have a 'Session' which depends on the context.")
|
panic("TodoController should be request scoped, we have a 'Session' which depends on the context.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ func (app *Application) Configure(configurators ...func(*Application)) *Applicat
|
||||||
// controller's methods, if matching.
|
// controller's methods, if matching.
|
||||||
//
|
//
|
||||||
// The dependencies can be changed per-controller as well via a `beforeActivate`
|
// The dependencies can be changed per-controller as well via a `beforeActivate`
|
||||||
// on the `Register` method or when the controller has the `BeforeActivation(c *ControllerActivator)`
|
// on the `Register` method or when the controller has the `BeforeActivation(b BeforeActivation)`
|
||||||
// method defined.
|
// method defined.
|
||||||
//
|
//
|
||||||
// It returns this Application.
|
// It returns this Application.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user