mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 18:00:54 +00:00
simple the session
This commit is contained in:
parent
52df1234bd
commit
76522d43af
13
router.go
13
router.go
@ -644,7 +644,13 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
|
|||||||
|
|
||||||
// session init
|
// session init
|
||||||
if SessionOn {
|
if SessionOn {
|
||||||
context.Input.CruSession = GlobalSessions.SessionStart(w, r)
|
var err error
|
||||||
|
context.Input.CruSession, err = GlobalSessions.SessionStart(w, r)
|
||||||
|
if err != nil {
|
||||||
|
Error(err)
|
||||||
|
middleware.Exception("503", rw, r, "")
|
||||||
|
return
|
||||||
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
context.Input.CruSession.SessionRelease(w)
|
context.Input.CruSession.SessionRelease(w)
|
||||||
}()
|
}()
|
||||||
@ -888,6 +894,11 @@ func (p *ControllerRegistor) recoverPanic(rw http.ResponseWriter, r *http.Reques
|
|||||||
if handler, ok := middleware.ErrorMaps[fmt.Sprint(err)]; ok {
|
if handler, ok := middleware.ErrorMaps[fmt.Sprint(err)]; ok {
|
||||||
handler(rw, r)
|
handler(rw, r)
|
||||||
return
|
return
|
||||||
|
} else if handler, ok := middleware.ErrorMaps["503"]; ok {
|
||||||
|
handler(rw, r)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
rw.Write([]byte(fmt.Sprint(err)))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Critical("the request url is ", r.URL.Path)
|
Critical("the request url is ", r.URL.Path)
|
||||||
|
Loading…
Reference in New Issue
Block a user