forked from golang/hotime
This commit is contained in:
parent
eedd972ac6
commit
2ba3fa42cf
@ -205,13 +205,16 @@ func (this *Application) handler(w http.ResponseWriter, req *http.Request) {
|
||||
},
|
||||
CacheIns: this.CacheIns,
|
||||
Resp: w, Req: req, Application: this, RouterString: s, Config: this.Config, Db: &this.Db, HandlerStr: req.RequestURI}
|
||||
//header默认设置
|
||||
header := w.Header()
|
||||
|
||||
//访问拦截true继续false暂停
|
||||
connectListenerLen:=len(this.connectListener)
|
||||
if connectListenerLen!= 0 {
|
||||
connectListenerLen := len(this.connectListener)
|
||||
if connectListenerLen != 0 {
|
||||
for i := 0; i < connectListenerLen; i++ {
|
||||
|
||||
if !this.connectListener[i](&context) {
|
||||
header.Set("Content-Type", "text/html; charset=utf-8")
|
||||
context.View()
|
||||
return
|
||||
}
|
||||
@ -225,6 +228,7 @@ func (this *Application) handler(w http.ResponseWriter, req *http.Request) {
|
||||
if this.Router[s[0]] != nil && this.Router[s[0]][s[1]] != nil && this.Router[s[0]][s[1]][s[2]] != nil {
|
||||
//控制层
|
||||
this.Router[s[0]][s[1]][s[2]](&context)
|
||||
header.Set("Content-Type", "text/html; charset=utf-8")
|
||||
context.View()
|
||||
return
|
||||
}
|
||||
@ -257,11 +261,15 @@ func (this *Application) handler(w http.ResponseWriter, req *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
header := w.Header()
|
||||
|
||||
//类型判断并设置Content-Type
|
||||
if strings.Contains(path, ".css") {
|
||||
header.Set("Content-Type", "text/css")
|
||||
header.Set("Content-Type", "text/css; charset=utf-8")
|
||||
//header.Get(Config["sessionName"].(string))
|
||||
}
|
||||
|
||||
//类型判断并设置Content-Type
|
||||
if strings.Contains(path, ".js") {
|
||||
header.Set("Content-Type", "application/javascript; charset=utf-8")
|
||||
//header.Get(Config["sessionName"].(string))
|
||||
}
|
||||
header.Set("Cache-Control", "public")
|
||||
|
Loading…
Reference in New Issue
Block a user