// AutoHandler creates a server Handler for auto proxy server.
433418
func AutoHandler(opts ...HandlerOption) Handler {
	h := &autoHandler{}
	h.Init(opts...)
	return h
}
1111846
func (c *Context) RoutesHandler(builder Builder) http.Handler {
	b := builder
	if b == nil {
		b = PassthroughBuilder
	}
	return NewRouter(c, b(NewOperationExecutor(c)))
}
181247
func NameHandler(name string, handler cfg.Handler) *HandlerName {
	return &HandlerName{
		Name:    name,
		Handler: handler,
	}
}
1312245
func (c *Client) UseHandler(phase string, fn context.HandlerFunc) *Client {
	c.Middleware.UseHandler(phase, fn)
	return c
}
820949
func (cm *ConnManager) listenHandler(listener net.Listener) {
	log.Infof("Server listening on %s", listener.Addr())
	for atomic.LoadInt32(&cm.stop) == 0 {
		conn, err := listener.Accept()
		if err != nil {
			// Only log the error if not forcibly shutting down.
			if atomic.LoadInt32(&cm.stop) == 0 {
				log.Errorf("Can't accept connection: %v", err)
			}
			continue
		}
		go cm.cfg.OnAccept(conn)
	}

	cm.wg.Done()
	log.Tracef("Listener handler done for %s", listener.Addr())
}
1032207
func NewHandler(plugin Plugin) *Handler {
	h := &Handler{plugin, sdk.NewHandler(manifest)}
	h.initMux()
	return h
}
757451
func (a *authenticator) authenticationHandler(w http.ResponseWriter, req *http.Request) {
	// Read name and password from the form (if accessed from browser)
	credentials := &credentials{
		Username: req.FormValue("name"),
		Password: req.FormValue("password"),
	}
	token, errCode, err := a.getTokenFor(credentials)
	if err != nil {
		a.formatter.Text(w, errCode, err.Error())
		return
	}
	// Writes cookie with token.
	http.SetCookie(w, &http.Cookie{
		Name:   cookieName,
		Path:   "/",
		MaxAge: int(a.expTime.Seconds()),
		Value:  token,
		Secure: false,
	})
	// Automatically move to index page.
	target := "/"
	http.Redirect(w, req, target, http.StatusMovedPermanently)
}
457168
func StatsHandler(h stats.Handler) ServerOption {
	return newFuncServerOption(func(o *serverOptions) {
		o.statsHandler = h
	})
}
1120279
func unauthorizedHandler(w http.ResponseWriter, r *http.Request) {
	http.Error(w, fmt.Sprintf("%s - %s",
		http.StatusText(http.StatusForbidden), FailureReason(r)),
		http.StatusForbidden)
	return
}
651334
func (r *registerer) addHandler(puType common.PUType, event common.Event, handler common.EventHandler) {
	r.handlers[puType][event] = handler
}
1366522
func AutoServer(name string) (*Server, error) {
	key := "rpc.server." + name
	if !config.Exist(key) {
		return nil, errors.Format("rpc: can't find config for server '%s'", name)
	}

	opts := ServerOptions{}
	err := config.UnmarshalOption(key, &opts)
	if err != nil {
		return nil, err
	}
	opts.Name = name
	return NewServer(opts)
}
1290279
func (b *EventBus) AddHandler(m eh.EventMatcher, h eh.EventHandler) {
	sub := b.subscription(m, h, false)
	go b.handle(m, h, sub)
}
1248212
func (d *DockerMonitor) addHandler(event Event, handler EventHandler) {
	d.handlers[event] = handler
}
1285702
func (n *Negroni) UseHandler(handler http.Handler) {
	n.Use(Wrap(handler))
}
1120434
func ServerErrorHandler(errorHandler transport.ErrorHandler) ServerOption {
	return func(s *Server) { s.errorHandler = errorHandler }
}
1181142
func (r *Router) UseHandler(handler http.Handler) *Router {
	r.Route("/*").All(handler.ServeHTTP)
	return r
}
1330013
func DefaultHTTPHandler(hndl http.Handler) Detector {
	if hndl == nil {
		hndl = http.DefaultServeMux
	}
	handler := ListenServerHandler(&http.Server{
		Handler: hndl,
	})
	return FallthroughDetector(handler)
}