Пример #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
func (f ContextHTTPHandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	f(web.NewContext(w, r))
}