mux

package
v1.4.0-alpha.2....-4dc418c Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package mux contains abstractions for http multiplexing of APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIContainer

type APIContainer struct {
	*restful.Container
	NonSwaggerRoutes PathRecorderMux
	SecretRoutes     Mux
}

APIContainer is a restful container which in addition support registering handlers that do not show up in swagger or in /

func NewAPIContainer

func NewAPIContainer(mux *http.ServeMux, s runtime.NegotiatedSerializer) *APIContainer

NewAPIContainer constructs a new container for APIs

type Mux

type Mux interface {
	Handle(pattern string, handler http.Handler)
	HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
}

Mux is an object that can register http handlers.

type PathRecorderMux

type PathRecorderMux struct {
	// contains filtered or unexported fields
}

PathRecorderMux wraps a mux object and records the registered paths. It is _not_ go routine safe.

func NewPathRecorderMux

func NewPathRecorderMux(mux Mux) *PathRecorderMux

NewPathRecorderMux creates a new PathRecorderMux with the given mux as the base mux.

func (*PathRecorderMux) BaseMux

func (m *PathRecorderMux) BaseMux() Mux

BaseMux returns the underlying mux.

func (*PathRecorderMux) Handle

func (m *PathRecorderMux) Handle(path string, handler http.Handler)

Handle registers the handler for the given pattern. If a handler already exists for pattern, Handle panics.

func (*PathRecorderMux) HandleFunc

func (m *PathRecorderMux) HandleFunc(path string, handler func(http.ResponseWriter, *http.Request))

HandleFunc registers the handler function for the given pattern.

func (*PathRecorderMux) HandledPaths

func (m *PathRecorderMux) HandledPaths() []string

HandledPaths returns the registered handler paths.

Jump to

Keyboard shortcuts

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