mux

package
v6.0.2+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2015 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Mount

func Mount(mountPoint string, ma Mountable) error

Mount mounts on the http.DefaultServeMux

func MountWrapped

func MountWrapped(mountPoint string, ma Mountable, wr stack.Wrapper) error

MountWrapps mounts on the http.DefaultServeMux

func MustMount

func MustMount(mountPoint string, ma Mountable)

func MustMountWrapped

func MustMountWrapped(mountPoint string, ma Mountable, wr stack.Wrapper)

Types

type Mountable

type Mountable interface {
	Mount(mx Muxer, mountPoint string) error
}

type Mux

type Mux struct {
	Debug bool
	// contains filtered or unexported fields
}

func New

func New() *Mux

func (*Mux) Handle

func (p *Mux) Handle(path string, rh http.Handler)

func (*Mux) HandleFunc

func (p *Mux) HandleFunc(path string, fn func(http.ResponseWriter, *http.Request))

func (*Mux) Handler

func (n *Mux) Handler(req *http.Request) http.Handler

func (*Mux) Mount

func (m *Mux) Mount(mountPoint string, ma Mountable) error

func (*Mux) MountWrapped

func (m *Mux) MountWrapped(mountPoint string, ma Mountable, wr stack.Wrapper) error

func (*Mux) MustMount

func (m *Mux) MustMount(mountPoint string, ma Mountable)

func (*Mux) MustMountWrapped

func (m *Mux) MustMountWrapped(mountPoint string, ma Mountable, wr stack.Wrapper)

func (*Mux) ServeHTTP

func (n *Mux) ServeHTTP(wr http.ResponseWriter, req *http.Request)

type Muxer

type Muxer interface {
	Handle(path string, h http.Handler)
	HandleFunc(path string, fn func(http.ResponseWriter, *http.Request))
	ServeHTTP(wr http.ResponseWriter, req *http.Request)
}

type WrappedMux

type WrappedMux struct {
	sync.Once
	// contains filtered or unexported fields
}

WrappedMux is a Muxer that wraps each handler that is registered by a wrapper

func NewWrappedMux

func NewWrappedMux(wr stack.Wrapper) *WrappedMux

func (*WrappedMux) Debug

func (wm *WrappedMux) Debug()

func (*WrappedMux) Handle

func (wm *WrappedMux) Handle(path string, h http.Handler)

Handle calls the Handle method of the muxer and passes the wrapped handler

func (*WrappedMux) HandleFunc

func (wm *WrappedMux) HandleFunc(path string, fn func(http.ResponseWriter, *http.Request))

func (*WrappedMux) ServeHTTP

func (wm *WrappedMux) ServeHTTP(wr http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL