1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-17 18:07:01 +00:00

8.4.0 | New MVC Features | Refactor examples and godoc for go 1.9 use. Read HISTORY.md.

Former-commit-id: 90c05e743052bc3722e7fefaa0cbb0ed5153a1fb
This commit is contained in:
kataras
2017-08-27 20:35:23 +03:00
parent a2de506f80
commit 42b123975c
100 changed files with 405 additions and 981 deletions

View File

@@ -4,7 +4,6 @@ import (
"sync"
"github.com/kataras/iris"
"github.com/kataras/iris/context"
"github.com/kataras/iris/sessions"
)
@@ -25,7 +24,7 @@ var owner = &Owner{
// Let's implement a context which will give us access
// to the client's Session with a trivial `ctx.Session()` call.
type Context struct {
context.Context
iris.Context
session *sessions.Session
}
@@ -49,7 +48,7 @@ var contextPool = sync.Pool{New: func() interface{} {
return &Context{}
}}
func acquire(original context.Context) *Context {
func acquire(original iris.Context) *Context {
ctx := contextPool.Get().(*Context)
ctx.Context = original // set the context to the original one in order to have access to iris's implementation.
ctx.session = nil // reset the session
@@ -62,8 +61,8 @@ func release(ctx *Context) {
// Handler will convert our handler of func(*Context) to an iris Handler,
// in order to be compatible with the HTTP API.
func Handler(h func(*Context)) context.Handler {
return func(original context.Context) {
func Handler(h func(*Context)) iris.Handler {
return func(original iris.Context) {
ctx := acquire(original)
h(ctx)
release(ctx)