Documentation ¶
Overview ¶
Package htto implements a simple and userful http framwork
Index ¶
Constants ¶
const ( // Go on exe PASS = iota //b=0 // Stop STOP //c=1 )
Variables ¶
var Sessions *session.Manager
Just a beego session manager
Functions ¶
Types ¶
type Context ¶
type Context struct { Out *Writer In *Reader ResponseWriter http.ResponseWriter Request *http.Request // contains filtered or unexported fields }
func NewContext ¶
func NewContext(w http.ResponseWriter, r *http.Request) *Context
New a Context
func NewContext(w http.ResponseWriter, r *http.Request, sess session.SessionStore) *Context { return &Context{ sess: sess, ResponseWriter: w, Request: r, } }
func (*Context) GetSess ¶
func (cxt *Context) GetSess() session.SessionStore
Get the request's session
type Controller ¶
type Controller struct { // A connection context Ctx *Context }
func (*Controller) Delete ¶
func (c *Controller) Delete()
Delete adds a request function to handle DELETE request.
func (*Controller) Get ¶
func (c *Controller) Get()
func (*Controller) Head ¶
func (c *Controller) Head()
Head adds a request function to handle HEAD request.
func (*Controller) Options ¶
func (c *Controller) Options()
Options adds a request function to handle OPTIONS request.
func (*Controller) Patch ¶
func (c *Controller) Patch()
Patch adds a request function to handle PATCH request.
func (*Controller) Post ¶
func (c *Controller) Post()
Post adds a request function to handle POST request.
func (*Controller) Prepare ¶
func (c *Controller) Prepare() int
func (*Controller) Put ¶
func (c *Controller) Put()
Put adds a request function to handle PUT request.
func (*Controller) Set ¶
func (c *Controller) Set(ctx *Context)
func NewController(w http.ResponseWriter, r *http.Request, sess session.SessionStore) *Controller { return &Controller{ Ctx: NewContext(w, r, sess), } }
type ControllerInterface ¶
type DefaultMux ¶
type DefaultMux struct { // All routes Routes map[string]ControllerInterface FileRoutes map[string]ControllerInterface }
var Mux *DefaultMux
A defaultmux user the go net ctrollor
func NewDefaultMux ¶
func NewDefaultMux() *DefaultMux
func (*DefaultMux) Add ¶
func (mux *DefaultMux) Add(match string, c ControllerInterface)
Add a router (warnning you can't use match("/") as the route)
func (*DefaultMux) AddGroup ¶
func (mux *DefaultMux) AddGroup(match string, group *MuxGroup)
Add a group(include his members).
func (*DefaultMux) ServeHTTP ¶
func (mux *DefaultMux) ServeHTTP(w http.ResponseWriter, r *http.Request)
Implements the handler
type MuxGroup ¶
type MuxGroup struct {
// contains filtered or unexported fields
}
A Group e.g. "/admin/login", "/admin/info" all belong to "/admin" group
func NewMuxGroup ¶
func NewMuxGroup() *MuxGroup
func (*MuxGroup) Add ¶
func (mux *MuxGroup) Add(match string, c ControllerInterface)
Add the group's member