fileserver

package
v0.0.0-...-f4c7a8f Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2014 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

fileserver enable the user to modify the path of a file request before serving the actual file.

This packages uses otto (from https://github.com/robertkrimen/otto) to enable the dynamic nature of the filter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	sync.RWMutex
	// Rules holds the code used to match the requests
	Rules *otto.Otto
	// Base is the base dir used to search for files
	Base string
	// Fallback is called if the Rules don't return
	// a valid path
	Fallback http.Handler
}

Handler implements the net/http.Handler interface and uses a javascript program to select which file should be loaded for a given request

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP implements the Handler interface

Jump to

Keyboard shortcuts

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