示例#1
0
func (this *SunnyRouter) ServeRequestedEndPoint(w http.ResponseWriter, r *http.Request, rep *RequestedEndPoint) {
	if rep != nil {
		ctxt := web.NewContext(w, r)
		ctxt.UPath = rep.UPath
		ctxt.PData = rep.PData

		if !HandleHeaders(ctxt, rep.EndPoint, rep.Handler) {
			if ctxthandler, ok := rep.Handler.(web.ContextHandler); ok {
				ctxthandler.ServeContextHTTP(ctxt)
			} else {
				rep.Handler.ServeHTTP(w, r)
			}
		}
	} else {
		http.NotFound(w, r)
	}
}
示例#2
0
func (this *DynamicHandler) ServeOptions(w http.ResponseWriter, r *http.Request, origin map[string]string) {
	this.ServeContextOptions(web.NewContext(w, r), origin)
}
示例#3
0
func (this *DynamicHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	this.ServeContextHTTP(web.NewContext(w, r))
}
示例#4
0
文件: route.go 项目: zaolab/sunnified
func (f ContextHTTPHandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	f(web.NewContext(w, r))
}