package module
v0.0.0-...-0761370 Latest Latest

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

Go to latest
Published: Aug 4, 2014 License: BSD-2-Clause Imports: 17 Imported by: 0






View Source
const (
	AbortIndex = math.MaxInt8 / 2

	MIMEJSON     = "application/json"
	MIMEXML      = "application/xml"
	MIMEXML2     = "text/xml"
	MIMEHTML     = "text/html"
	MIMEPlain    = "text/plain"
	MIMEPOSTForm = "application/x-www-form-urlencoded"


This section is empty.


This section is empty.


type Context

type Context struct {
	Request *http.Request
	Writer  ResponseWriter
	Keys    map[string]interface{}
	Engine  *Engine
	// contains filtered or unexported fields

func (*Context) Abort

func (c *Context) Abort(code int)

func (*Context) Bind

func (c *Context) Bind(obj interface{}) bool

func (*Context) BindWith

func (c *Context) BindWith(obj interface{}, b binding.Binding) bool

func (*Context) Copy

func (c *Context) Copy() *Context

func (*Context) Data

func (c *Context) Data(code int, contentType string, data []byte)

func (*Context) Delete

func (c *Context) Delete(key string)

func (*Context) File

func (c *Context) File(filepath string)

func (*Context) Get

func (c *Context) Get(key string) (interface{}, error)

func (*Context) HTML

func (c *Context) HTML(code int, name string, obj interface{})

func (*Context) JSON

func (c *Context) JSON(code int, obj interface{})

func (*Context) MustGet

func (c *Context) MustGet(key string) interface{}

func (*Context) Next

func (c *Context) Next()

func (*Context) Render

func (c *Context) Render(code int, render render.Render, obj ...interface{})

func (*Context) Set

func (c *Context) Set(key string, item interface{})

func (*Context) String

func (c *Context) String(code int, format string, values ...interface{})

type Engine

type Engine struct {

	HTMLRender render.Render
	// contains filtered or unexported fields

func Default

func Default() *Engine

func New

func New() *Engine

func (*Engine) ErrorHandler

func (engine *Engine) ErrorHandler(err error, handlers ...HandlerFunc)

func (*Engine) GetErrorHandler

func (engine *Engine) GetErrorHandler(err error) []HandlerFunc

func (*Engine) GetStatusHandler

func (engine *Engine) GetStatusHandler(code int) []HandlerFunc

func (*Engine) LoadHTMLFiles

func (engine *Engine) LoadHTMLFiles(files ...string)

func (*Engine) LoadHTMLGlob

func (engine *Engine) LoadHTMLGlob(pattern string)

func (*Engine) NoRoute

func (engine *Engine) NoRoute(handlers ...HandlerFunc)

func (*Engine) Run

func (engine *Engine) Run(addr string)

func (*Engine) RunTLS

func (engine *Engine) RunTLS(addr string, cert string, key string)

func (*Engine) ServeHTTP

func (engine *Engine) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*Engine) SetHTMLTemplate

func (engine *Engine) SetHTMLTemplate(templ *template.Template)

func (*Engine) StatusHandler

func (engine *Engine) StatusHandler(code int, handlers ...HandlerFunc)

func (*Engine) StrictSlash

func (engine *Engine) StrictSlash(strictSlash bool) *Engine

func (*Engine) Use

func (engine *Engine) Use(middlewares ...HandlerFunc)

type HandlerFunc

type HandlerFunc func(*Context)

func Logger

func Logger() HandlerFunc

func Recovery

func Recovery() HandlerFunc

Recovery returns a middleware that recovers from any panics and writes a 500 if there was one. While Martini is in development mode, Recovery will also output the panic as HTML.

type ResponseWriter

type ResponseWriter interface {
	GetStatus() int
	GetWritten() bool

	Reset(http.ResponseWriter, *Context)

type RouterGroup

type RouterGroup struct {
	Handlers []HandlerFunc
	// contains filtered or unexported fields

func (*RouterGroup) DELETE

func (group *RouterGroup) DELETE(pattern string, handlers ...HandlerFunc) *router.Route

func (*RouterGroup) GET

func (group *RouterGroup) GET(pattern string, handlers ...HandlerFunc) *router.Route

func (*RouterGroup) Group

func (group *RouterGroup) Group(component string, handlers ...HandlerFunc) *RouterGroup

func (*RouterGroup) HEAD

func (group *RouterGroup) HEAD(pattern string, handlers ...HandlerFunc) *router.Route

func (*RouterGroup) HandleFunc

func (group *RouterGroup) HandleFunc(pattern string, handlers []HandlerFunc) *router.Route

func (*RouterGroup) OPTIONS

func (group *RouterGroup) OPTIONS(pattern string, handlers ...HandlerFunc) *router.Route

func (*RouterGroup) PATCH

func (group *RouterGroup) PATCH(pattern string, handlers ...HandlerFunc) *router.Route

func (*RouterGroup) POST

func (group *RouterGroup) POST(pattern string, handlers ...HandlerFunc) *router.Route

func (*RouterGroup) PUT

func (group *RouterGroup) PUT(pattern string, handlers ...HandlerFunc) *router.Route

func (*RouterGroup) Static

func (group *RouterGroup) Static(p, root string)

func (*RouterGroup) Use

func (group *RouterGroup) Use(middlewares ...HandlerFunc)

type ServerWriter

type ServerWriter struct {
	// contains filtered or unexported fields

func (*ServerWriter) GetStatus

func (w *ServerWriter) GetStatus() int

func (*ServerWriter) GetWritten

func (w *ServerWriter) GetWritten() bool

func (*ServerWriter) Reset

func (w *ServerWriter) Reset(writer http.ResponseWriter, c *Context)

func (*ServerWriter) Status

func (w *ServerWriter) Status(code int)

func (*ServerWriter) Write

func (w *ServerWriter) Write(data []byte) (int, error)

func (*ServerWriter) WriteHeader

func (w *ServerWriter) WriteHeader(code int)


Path Synopsis

Jump to

Keyboard shortcuts

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