Documentation ¶
Index ¶
- Variables
- type CORSHeader
- type HTTP_METHOD
- type HttpFiltrate
- type HttpHandle
- type HttpRedirectData
- type HttpRouter
- func (slf *HttpRouter) AddHttpFiltrate(FiltrateFun HttpFiltrate) bool
- func (slf *HttpRouter) GET(url string, handle HttpHandle) bool
- func (slf *HttpRouter) GetFormFileKey() string
- func (slf *HttpRouter) POST(url string, handle HttpHandle) bool
- func (slf *HttpRouter) Router(session *HttpSession)
- func (slf *HttpRouter) SetFormFileKey(formFileKey string)
- func (slf *HttpRouter) SetServeFile(method HTTP_METHOD, urlPath string, dirname string) error
- type HttpService
- func (httpService *HttpService) AddFiltrate(FiltrateFun HttpFiltrate) bool
- func (httpService *HttpService) HttpEventHandler(ev event.IEvent)
- func (httpService *HttpService) OnInit() error
- func (httpService *HttpService) ProcessFile(session *HttpSession)
- func (httpService *HttpService) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (httpService *HttpService) SetAllowCORS(corsHeader *CORSHeader)
- func (httpService *HttpService) SetHttpRouter(httpRouter IHttpRouter, eventHandler event.IEventHandler)
- func (httpService *HttpService) StartListen()
- type HttpSession
- func (slf *HttpSession) AddHeader(key, value string)
- func (slf *HttpSession) DelHeader(key string)
- func (slf *HttpSession) Done()
- func (slf *HttpSession) GetBody() []byte
- func (slf *HttpSession) GetHeader(key string) string
- func (slf *HttpSession) GetMethod() HTTP_METHOD
- func (slf *HttpSession) GetPath() string
- func (slf *HttpSession) GetRawQuery() string
- func (slf *HttpSession) Handle()
- func (slf *HttpSession) Query(key string) (string, bool)
- func (slf *HttpSession) Redirect(url string, cookieList []*http.Cookie)
- func (slf *HttpSession) SetHeader(key, value string)
- func (slf *HttpSession) Write(msg []byte)
- func (slf *HttpSession) WriteJsonDone(statusCode int, msgJson interface{}) error
- func (slf *HttpSession) WriteStatusCode(statusCode int)
- type IHttpRouter
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultProcessTimeout time.Duration = time.Second * 10
View Source
var DefaultReadTimeout time.Duration = time.Second * 10
View Source
var DefaultWriteTimeout time.Duration = time.Second * 10
Functions ¶
This section is empty.
Types ¶
type CORSHeader ¶
func NewAllowCORSHeader ¶
func NewAllowCORSHeader() *CORSHeader
func (*CORSHeader) AddAllowHeader ¶
func (slf *CORSHeader) AddAllowHeader(key string, val string)
type HTTP_METHOD ¶
type HTTP_METHOD int
const ( METHOD_NONE HTTP_METHOD = iota METHOD_GET METHOD_POST METHOD_INVALID )
type HttpFiltrate ¶
type HttpFiltrate func(session *HttpSession) bool //true is pass
type HttpHandle ¶
type HttpHandle func(session *HttpSession)
type HttpRedirectData ¶
type HttpRouter ¶
type HttpRouter struct {
// contains filtered or unexported fields
}
func (*HttpRouter) AddHttpFiltrate ¶
func (slf *HttpRouter) AddHttpFiltrate(FiltrateFun HttpFiltrate) bool
func (*HttpRouter) GET ¶
func (slf *HttpRouter) GET(url string, handle HttpHandle) bool
func (*HttpRouter) GetFormFileKey ¶
func (slf *HttpRouter) GetFormFileKey() string
func (*HttpRouter) POST ¶
func (slf *HttpRouter) POST(url string, handle HttpHandle) bool
func (*HttpRouter) Router ¶
func (slf *HttpRouter) Router(session *HttpSession)
func (*HttpRouter) SetFormFileKey ¶
func (slf *HttpRouter) SetFormFileKey(formFileKey string)
func (*HttpRouter) SetServeFile ¶
func (slf *HttpRouter) SetServeFile(method HTTP_METHOD, urlPath string, dirname string) error
type HttpService ¶
func (*HttpService) AddFiltrate ¶
func (httpService *HttpService) AddFiltrate(FiltrateFun HttpFiltrate) bool
func (*HttpService) HttpEventHandler ¶
func (httpService *HttpService) HttpEventHandler(ev event.IEvent)
func (*HttpService) OnInit ¶
func (httpService *HttpService) OnInit() error
func (*HttpService) ProcessFile ¶
func (httpService *HttpService) ProcessFile(session *HttpSession)
func (*HttpService) ServeHTTP ¶
func (httpService *HttpService) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*HttpService) SetAllowCORS ¶
func (httpService *HttpService) SetAllowCORS(corsHeader *CORSHeader)
func (*HttpService) SetHttpRouter ¶
func (httpService *HttpService) SetHttpRouter(httpRouter IHttpRouter, eventHandler event.IEventHandler)
func (*HttpService) StartListen ¶
func (httpService *HttpService) StartListen()
type HttpSession ¶
type HttpSession struct {
// contains filtered or unexported fields
}
func (*HttpSession) AddHeader ¶
func (slf *HttpSession) AddHeader(key, value string)
func (*HttpSession) DelHeader ¶
func (slf *HttpSession) DelHeader(key string)
func (*HttpSession) Done ¶
func (slf *HttpSession) Done()
func (*HttpSession) GetBody ¶
func (slf *HttpSession) GetBody() []byte
func (*HttpSession) GetHeader ¶
func (slf *HttpSession) GetHeader(key string) string
func (*HttpSession) GetMethod ¶
func (slf *HttpSession) GetMethod() HTTP_METHOD
func (*HttpSession) GetPath ¶
func (slf *HttpSession) GetPath() string
func (*HttpSession) GetRawQuery ¶
func (slf *HttpSession) GetRawQuery() string
func (*HttpSession) Handle ¶
func (slf *HttpSession) Handle()
func (*HttpSession) Redirect ¶
func (slf *HttpSession) Redirect(url string, cookieList []*http.Cookie)
func (*HttpSession) SetHeader ¶
func (slf *HttpSession) SetHeader(key, value string)
func (*HttpSession) Write ¶
func (slf *HttpSession) Write(msg []byte)
func (*HttpSession) WriteJsonDone ¶
func (slf *HttpSession) WriteJsonDone(statusCode int, msgJson interface{}) error
func (*HttpSession) WriteStatusCode ¶
func (slf *HttpSession) WriteStatusCode(statusCode int)
type IHttpRouter ¶
type IHttpRouter interface { GET(url string, handle HttpHandle) bool POST(url string, handle HttpHandle) bool Router(session *HttpSession) SetServeFile(method HTTP_METHOD, urlPath string, dirname string) error SetFormFileKey(formFileKey string) GetFormFileKey() string AddHttpFiltrate(FiltrateFun HttpFiltrate) bool }
func NewHttpHttpRouter ¶
func NewHttpHttpRouter() IHttpRouter
Click to show internal directories.
Click to hide internal directories.