framework

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2015 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Error403 = &HTTPError{403, "Authorization required."}
View Source
var Error404 = &HTTPError{404, "Resource not found."}
View Source
var Error500 = &HTTPError{500, "Internal service error."}

Functions

func WriteView

func WriteView(view View, res http.ResponseWriter)

Types

type CSPWrapper

type CSPWrapper struct {
	CSP string
	View
}

func (*CSPWrapper) Headers

func (c *CSPWrapper) Headers() Headers

type CopyView

type CopyView struct {
	Status int
	Length int
	Type   string
	Reader io.ReadCloser
}

func (*CopyView) Code

func (j *CopyView) Code() int

func (*CopyView) ContentLength

func (j *CopyView) ContentLength() int

func (*CopyView) ContentType

func (j *CopyView) ContentType() string

func (*CopyView) Headers

func (j *CopyView) Headers() Headers

func (*CopyView) Write

func (j *CopyView) Write(w io.Writer)

type FileView

type FileView struct {
	File io.ReadCloser
	Name string
	Size int
}

File View Will Render a File to the Http Response

func GetFile

func GetFile(prefix string, request string) (*FileView, error)

func (*FileView) Code

func (b *FileView) Code() int

func (*FileView) ContentLength

func (b *FileView) ContentLength() int

func (*FileView) ContentType

func (b *FileView) ContentType() string

func (*FileView) Headers

func (h *FileView) Headers() Headers

func (*FileView) Write

func (f *FileView) Write(w io.Writer)

type HTTPError

type HTTPError struct {
	ErrorCode int
	Message   string
}

Http Error

func (*HTTPError) Code

func (h *HTTPError) Code() int

func (*HTTPError) ContentLength

func (h *HTTPError) ContentLength() int

func (*HTTPError) ContentType

func (h *HTTPError) ContentType() string

func (*HTTPError) Headers

func (h *HTTPError) Headers() Headers

func (*HTTPError) Write

func (h *HTTPError) Write(res io.Writer)

type Headers

type Headers map[string]string

type JSONView

type JSONView struct {
	Content interface{}
	// contains filtered or unexported fields
}

func (*JSONView) Code

func (j *JSONView) Code() int

func (*JSONView) ContentLength

func (j *JSONView) ContentLength() int

func (*JSONView) ContentType

func (j *JSONView) ContentType() string

func (*JSONView) Headers

func (j *JSONView) Headers() Headers

func (*JSONView) Write

func (j *JSONView) Write(w io.Writer)

type RawView

type RawView struct {
	Content []byte
	Type    string
}

func (*RawView) Code

func (j *RawView) Code() int

func (*RawView) ContentLength

func (j *RawView) ContentLength() int

func (*RawView) ContentType

func (j *RawView) ContentType() string

func (*RawView) Headers

func (j *RawView) Headers() Headers

func (*RawView) Write

func (j *RawView) Write(w io.Writer)

type View

type View interface {
	Write(io.Writer)
	ContentType() string
	ContentLength() int
	Code() int
	Headers() Headers
}

func ProxyURL

func ProxyURL(url string) View

func ServeFile

func ServeFile(prefix string, request string) View

Blatantly stolen from robfig's Revel Framework

Jump to

Keyboard shortcuts

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