Exemple #1
0
func (this *SrcHandler) getHandler(w http.ResponseWriter, r *http.Request) {
	glog.V(2).Infoln("src GET handler")
	rawQuery := r.URL.RawQuery
	q, _ := url.ParseQuery(rawQuery)
	t := q.Get("type")
	if t == "" {
		t = "json"
	}
	switch t { // Likely faster not to use a map[string]func.
	case "png":
		cachinghandler.HandleWithCache(w, r, "srcs-png", rawQuery)
	case "inline-graph":
		cachinghandler.HandleWithCache(w, r, "srcs-inline-graph", rawQuery)
	case "json":
		cachinghandler.HandleWithCache(w, r, "srcs-json", rawQuery)
	default:
		handlerutils.HttpError(w, "Bad srcs 'type' parameter: "+t, http.StatusBadRequest)
	}
}
Exemple #2
0
func (this *RecordHandler) getHandler(w http.ResponseWriter, r *http.Request, rawQuery string) {
	cachinghandler.HandleWithCache(w, r, "record-json", rawQuery)
}