override

package
v0.0.0-...-2840294 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2015 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Override implements a http.Handler, that enables prefix matching based routing. For example, if you want to serve an static directory using http.FileServer and http.Dir, but you want to redirect the path "/" to your dynamic main page, and the path "/wiki/<wiki-page>" to your Wiki, and the path "/<yyyy>/<mm>/<dd>/<title>" to your blog entrys, you can use "override" to do the job.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Overrider

type Overrider struct {
	Base  http.Handler
	Overs []*Patterned
}

func (*Overrider) Add

func (o *Overrider) Add(prefix string, h http.Handler)

func (*Overrider) AddExact

func (o *Overrider) AddExact(exact string, h http.Handler)

func (*Overrider) AddRegexp

func (o *Overrider) AddRegexp(re string, h http.Handler) error

func (*Overrider) AddRegexpPOSIX

func (o *Overrider) AddRegexpPOSIX(re string, h http.Handler) error

func (*Overrider) ServeHTTP

func (o *Overrider) ServeHTTP(resp http.ResponseWriter, req *http.Request)

type Patterned

type Patterned struct {
	http.Handler
	Prefix string
	Exact  string
	Regexp *regexp.Regexp
}

func (*Patterned) Match

func (p *Patterned) Match(r *http.Request) bool

Jump to

Keyboard shortcuts

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