// HandlerPath returns the handler path
2644
func HandlerPath(h interface{}) string {
	v := reflect.ValueOf(h)
	t := v.Type()
	switch t.Kind() {
	case reflect.Func:
		return runtime.FuncForPC(v.Pointer()).Name()
	case reflect.Ptr:
		t = t.Elem()
		fallthrough
	case reflect.Struct:
		return t.PkgPath() + `.` + t.Name()
	}
	return ``
}
987873
func (r *DynamicRouter) HandleFunc(pattern string, handler Handler, filters ...HttpFilter) {
	r.registerHandler(SplitPath(pattern), handler, filters...)
}
1206867
func Path(path string) p.Plugin {
	return p.NewRequestPlugin(func(ctx *c.Context, h c.Handler) {
		ctx.Request.URL.Path = normalizePath(path)
		h.Next(ctx)
	})
}
370657
func CookiePath(path string) CookieOption {
	return func(c *http.Cookie) {
		c.Path = path
	}
}
75569
func (r *customRouter) HandleRequest(ctx context.Context) {
	path := ctx.Path()
	ctx.Application().Logger().Infof("Requested resource path: %s", path)

	parts := strings.Split(path, "/")[1:]
	staticPath := "/" + parts[0]
	for _, route := range r.provider.GetRoutes() {
		if strings.HasPrefix(route.Path, staticPath) && route.Method == ctx.Method() {
			paramParts := parts[1:]
			for _, paramValue := range paramParts {
				for _, p := range route.Tmpl().Params {
					ctx.Params().Set(p.Name, paramValue)
				}
			}

			ctx.SetCurrentRouteName(route.Name)
			ctx.Do(route.Handlers)
			return
		}
	}

	// if nothing found...
	ctx.StatusCode(iris.StatusNotFound)
}
764747
func (r *Route) Handler(handler http.Handler) *Route {
	if r.err == nil {
		r.handler = handler
	}
	return r
}
43198
func (h *CSRFHandler) ExemptPath(path string) {
	h.exemptPaths = append(h.exemptPaths, path)
}
928695
func (s *Subrouter) Handle(method string, path string, h http.Handler) {
	// calcular path
	fullPath := s.getFullPath(path)
	hrh := func(w http.ResponseWriter, req *http.Request, params map[string]string) {
		httpcontext.Set(req, paramsKey, params)
		s.Stack.Then(h).ServeHTTP(w, req)
	}
	s.router.Handle(method, fullPath, hrh)
}
679580
func (r *Router) Handler(req *http.Request) (route *Route, h Handler, vars map[string]string) {
	var match mux.RouteMatch

	if r.mux.Match(req, &match) {
		route = r.getOrCreateRoute(match.Route, "")
		h = match.Handler.(Handler)
		vars = match.Vars
		return
	}

	if r.NotFoundHandler == nil {
		h = HandlerFunc(NotFound)
		return
	}

	h = r.NotFoundHandler
	return
}
916771
func HandlerName(entry *logrus.Entry, _ *CustomFormatter) (interface{}, error) {
	if value, ok := entry.Data["name"]; ok {
		return value.(string), nil
	}
	return "", nil
}
1303186
func (app *Application) handler(ctx *Context) {
	for prefix, staticPathSlice := range app.staticRouter {
		if strings.HasPrefix(ctx.Request.URL.Path, prefix) {
			for _, staticPath := range staticPathSlice {
				filePath := path.Join(staticPath, ctx.Request.URL.Path[len(prefix):])
				fileInfo, err := os.Stat(filePath)
				if err == nil && !fileInfo.IsDir() {
					staticHandler(ctx, filePath)
					return
				}
			}
		}
	}

	handler, params, err := app.router.FindRoute(ctx.Request.Method, ctx.Request.URL.Path)
	if err != nil {
		app.handleError(ctx, 404)
	} else {
		ctx.Params = params
		handler(ctx)
	}
	ctx.IsSent = true
}
373960
func (r *Router) HandleRequest(ctx *fasthttp.RequestCtx) {
	c := r.pool.Get().(*Context)
	c.init(ctx)
	c.handlers, c.pnames = r.find(string(ctx.Method()), string(ctx.Path()), c.pvalues)
	if err := c.Next(); err != nil {
		r.handleError(c, err)
	}
	r.pool.Put(c)
}
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))
	}
}
705352
func (m *Mux) HandlerFunc(h http.Handler) http.HandlerFunc {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		h.ServeHTTP(w, r)
	})
}
968006
func (w Goreland) RenderPath(path []Pather) string {

	s := ""
	for _, p := range path {
		pT := p.(*Truck)
		s = pT.label + " " + s
	}
	return s
}
1005310
func (r *Router) Find(meth, path string, ctx *Context) (hand HandlerFunc) {

	routes := r.routes[meth]

	for _, route := range routes {
		if pa, ok := route.test(path); ok {
			ctx.param = pa
			return route.Handler
		}
	}

	// NOTE: This is slow, and also pointless if there is a catch all (*) route

	// allowed := make([]string, 0, len(r.routes))
	// for mech, routes := range r.routes {
	// 	if mech == meth {
	// 		continue
	// 	}
	// 	for _, route := range routes {
	// 		if _, ok := route.test(path); ok {
	// 			allowed = append(allowed, mech)
	// 		}
	// 	}
	// }

	// if len(allowed) >= 1 {
	// 	return func(c *Context) error {
	// 		return NewHTTPError(405)
	// 	}
	// }

	return func(c *Context) error {
		return NewHTTPError(404)
	}

}
967986
func NewHandlerMap(rhs []RouteHandler) HandlerMap {
	hm := HandlerMap{}
	for _, rh := range rhs {
		route := HTTPRoute{
			Path:   rh.Path,
			Method: rh.Method,
		}
		hm[route] = rh.Handler
	}
	return hm
}