|
@@ -56,9 +56,7 @@ func New() *Engine {
|
|
|
engine.router.NotFound = engine.handle404
|
|
engine.router.NotFound = engine.handle404
|
|
|
engine.router.MethodNotAllowed = engine.handle405
|
|
engine.router.MethodNotAllowed = engine.handle405
|
|
|
engine.pool.New = func() interface{} {
|
|
engine.pool.New = func() interface{} {
|
|
|
- c := &Context{Engine: engine}
|
|
|
|
|
- c.Writer = &c.writermem
|
|
|
|
|
- return c
|
|
|
|
|
|
|
+ return engine.allocateContext()
|
|
|
}
|
|
}
|
|
|
return engine
|
|
return engine
|
|
|
}
|
|
}
|
|
@@ -70,6 +68,12 @@ func Default() *Engine {
|
|
|
return engine
|
|
return engine
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+func (engine *Engine) allocateContext() (c *Context) {
|
|
|
|
|
+ c = &Context{Engine: engine}
|
|
|
|
|
+ c.Writer = &c.writermem
|
|
|
|
|
+ return
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
func (engine *Engine) LoadHTMLGlob(pattern string) {
|
|
func (engine *Engine) LoadHTMLGlob(pattern string) {
|
|
|
if IsDebugging() {
|
|
if IsDebugging() {
|
|
|
render.HTMLDebug.AddGlob(pattern)
|
|
render.HTMLDebug.AddGlob(pattern)
|