// Handle adds a route with method, path and handler.
326306
func (rt *Router) Handle(method, path string, handler http.Handler) {
	if len(path) == 0 || path[0] != '/' {
		panic(fmt.Errorf("router: path %q must begin with %q", path, "/"))
	}

	// Get (or set) tree for method.
	n := rt.trees[method]
	if n == nil {
		n = new(node)
		rt.trees[method] = n
	}

	// Put parameters in their own node.
	parts := splitPath(path)
	var s string
	var params map[string]uint16
	for i, part := range parts {
		s += "/"
		if len(part) > 0 && part[0] == ':' { // It's a parameter.
			n.makeChild(s, params, nil, nil, (i == 0 && s == "/")) // Make child without ":".
			part = part[1:]
			reSep := strings.IndexByte(part, ':') // Search for a name/regexp separator.
			var re *regexp.Regexp
			if reSep == -1 { // No regular expression.
				if part == "" {
					panic(fmt.Errorf("router: path %q has anonymous parameter", path))
				}
				if params == nil {
					params = make(map[string]uint16)
				}
				params[part] = uint16(i) // Store parameter name with part index.

			} else { // Parameter comes with regular expression.
				if name := part[:reSep]; name != "" {
					if params == nil {
						params = make(map[string]uint16)
					}
					params[name] = uint16(i) // Store parameter name with part index.
				}
				res := part[reSep+1:]
				if res == "" {
					panic(fmt.Errorf("router: path %q has empty regular expression", path))
				}
				re = regexp.MustCompile(res)
			}
			s += ":"               // Only keep colon to represent parameter in tree.
			if i == len(parts)-1 { // Parameter is the last part: make it with handler.
				n.makeChild(s, params, re, handler, false)
			} else {
				n.makeChild(s, params, re, nil, false)
			}
		} else {
			s += part
			if i == len(parts)-1 { // Last part: make it with handler.
				if s != "/" && isWildcard(s) {
					if params == nil {
						params = make(map[string]uint16)
					}
					params["*"] = uint16(i)
				}
				n.makeChild(s, params, nil, handler, (i == 0 && s == "/"))
			}
		}
	}
}
637674
func (r *Router) Handle(method, path string, handle Handle) {
	r.Router.Handle(method, path, r.middlewareSelect(handle))
}
344079
func (self *StreamHandler) Handle(record *LogRecord) int {
	return self.BaseHandler.Handle2(self, record)
}
545960
func (m *mux) Handle(method, path string, handle MuxHandler) {
	hthandle := func(rw http.ResponseWriter, req *http.Request, htparams map[string]string) {
		params := req.URL.Query()
		for n, p := range htparams {
			params.Set(n, p)
		}
		handle(rw, req, params)
	}
	m.handles[method+path] = handle
	m.router.Handle(method, path, hthandle)
}
943235
func (m *Mux) Handle(method, pattern string, handler http.HandlerFunc) {
	if method == "" {
		panic(fmt.Errorf("invalid method"))
	}
	m.trie.Parse(pattern).Handle(strings.ToUpper(method), handler)
}
1089814
func (g *GoHttpServer) Handle(w http.ResponseWriter, r *http.Request) {
	// This section is called if the developer has added custom mux to the app
	if g.HasAppMux && g.handleAppMux(w, r) {
		return
	}
	g.handleMux(w, r)
}
872949
func (m *Mux) Handle(expr string, handler http.Handler) error {
	return m.router.UpsertRoute(expr, handler)
}
490254
func (fn UpdatePetWithFormHandlerFunc) Handle(params UpdatePetWithFormParams, principal interface{}) middleware.Responder {
	return fn(params, principal)
}
1197925
func (m *Mux) Handler(method, path string, handler HandlerFunc) Handler {
	return Handler{
		Method: method,
		Path:   path,
		Func:   handler,
	}
}
1256731
func Handle(route string, method string, httpHandler http.Handler) {
	mainServer.Handle(route, method, httpHandler)
}
938839
func (m *PathRecorderMux) Handle(path string, handler http.Handler) {
	m.lock.Lock()
	defer m.lock.Unlock()
	m.trackCallers(path)

	m.exposedPaths = append(m.exposedPaths, path)
	m.pathToHandler[path] = handler
	m.refreshMuxLocked()
}
267740
func (h *Handler) Handle(err error) {
	// Get the context from the error
	ctx := keyvals.ToMap(emperror.Context(err))

	// Expose the stackTracer interface on the outer error (if there is stack trace in the error)
	// Convert error with stack trace to an internal error type
	if e, ok := emperror.ExposeStackTrace(err).(stackTracer); ok {
		err = newCauseStacker(e)
	}

	if req, ok := httperr.HTTPRequest(err); ok {
		h.client.RequestErrorWithStackSkipWithExtras(rollbar.ERR, req, err, 3, ctx)

		return
	}

	h.client.ErrorWithStackSkipWithExtras(rollbar.ERR, err, 3, ctx)
}
764747
func (r *Route) Handler(handler http.Handler) *Route {
	if r.err == nil {
		r.handler = handler
	}
	return r
}
1013392
func (r *Router) handle(handlerName string, h http.HandlerFunc) httprouter.Handle {
	if r.instrh != nil {
		// This needs to be outside the closure to avoid data race when reading and writing to 'h'.
		h = r.instrh(handlerName, h)
	}
	return func(w http.ResponseWriter, req *http.Request, params httprouter.Params) {
		ctx, cancel := context.WithCancel(req.Context())
		defer cancel()

		for _, p := range params {
			ctx = context.WithValue(ctx, param(p.Key), p.Value)
		}
		h(w, req.WithContext(ctx))
	}
}
1363244
func Handle(handler Handler, err error) {
	if err != nil {
		handler.Handle(err)
	}
}
707504
func (r *Router) Handler(method string, path string, handler http.Handler) {
	r.Router.Handler(method, path, handler)
}
1120545
func (conn *Conn) Handle(name string, h Handler) Remover {
	return conn.fgHandlers.add(name, h)
}