Documentation ¶
Index ¶
- Variables
- func AddFileRouter(routerName, folder string, filter func([]string, os.FileInfo) bool)
- func AddGZipStaticRouter(routerName, folder string, openCache bool, suffixes ...string)
- func AddRouter(httpPath string, handlerBuilder func() IHandler)
- func AddStaticRouter(routerName, folder string)
- func AsyncRun(port int) chan error
- func GZipCompress(bs []byte) []byte
- func GZipUncompress(bs []byte) (res []byte, e error)
- func HandleException(msg string)
- func RouterRunWithTimeout(port int, readTimeout, writeTimeout time.Duration) error
- func Run(port int) error
- func SetTplDir(folder string)
- func URLDecode(s string) string
- func URLEncode(s string) string
- type Handler
- func (this *Handler) GetBody() (body []byte)
- func (this *Handler) GetFileParam(key string) (f *MultipartFileData)
- func (this *Handler) GetFileParams() map[string]*MultipartFileData
- func (this *Handler) GetGetParam(key string) (res string)
- func (this *Handler) GetGetParamMap() map[string]string
- func (this *Handler) GetHeader(key string) string
- func (this *Handler) GetHeaderArr(key string) []string
- func (this *Handler) GetHeaders() map[string][]string
- func (this *Handler) GetIO() (*http.Request, http.ResponseWriter)
- func (this *Handler) GetPostIntParam(key string, defaultVal int) int
- func (this *Handler) GetPostParam(key string) (value interface{})
- func (this *Handler) GetPostParams() map[string]interface{}
- func (this *Handler) GetPostStrParam(key string) (value string)
- func (this *Handler) GetRouterPath() []string
- func (this *Handler) GetRouterPathAt(index int) string
- func (this *Handler) Handle()
- func (this *Handler) IP() (ip string)
- func (this *Handler) NoResponse()
- func (this *Handler) ParseParams(pointer interface{}) error
- func (this *Handler) Prepare()
- func (this *Handler) Redirect(code int, url string)
- func (this *Handler) ResponseAccessCrossOrigin(headers map[string][]string, allowHeaders, exposeHeaders []string)
- func (this *Handler) ResponseData(data interface{})
- func (this *Handler) ResponseHeaders(headers map[string][]string)
- func (this *Handler) ResponseNothing() bool
- func (this *Handler) ResponseOK()
- func (this *Handler) ResponseStatus(code int)
- func (this *Handler) SetStatus(status int)
- func (this *Handler) StopRun()
- func (this *Handler) Tpl(fileName string, datas interface{}, subTpls ...string) (e error)
- func (this *Handler) WriteString(msg string)
- type HttpServer
- func (this *HttpServer) AddFileRouter(routerName, folder string, filter func([]string, os.FileInfo) bool)
- func (this *HttpServer) AddGZipStaticRouter(routerName, folder string, openCache bool, suffixes ...string)
- func (this *HttpServer) AddRouter(httpPath string, handlerBuilder func() IHandler)
- func (this *HttpServer) AddStaticRouter(routerName, folder string)
- func (this *HttpServer) AsyncRun(port int) chan error
- func (this *HttpServer) Close() error
- func (this *HttpServer) RouterRunWithTimeout(port int, readTimeout, writeTimeout time.Duration) error
- func (this *HttpServer) Run(port int) error
- type IHandler
- type MultipartFileData
- type Stream
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Err_Abort = errors.New("Abort by you") MaxStaticFileSize int64 = 1024 * 1024 * 10 // 10m StreamBuffSize = 4096 ReadTimeout = time.Second * 600 WriteTimeout = time.Second * 600 DefaultServer = &HttpServer{IsLog: true} XmlParser func([]byte) (map[string]interface{}, error) = nil Err_HandleMetUnimplemented = errors.New("The handle method is not implemented") )
Functions ¶
func AddFileRouter ¶
func AddGZipStaticRouter ¶
func AddStaticRouter ¶
func AddStaticRouter(routerName, folder string)
func GZipCompress ¶
func GZipUncompress ¶
func HandleException ¶
func HandleException(msg string)
func RouterRunWithTimeout ¶
Types ¶
type Handler ¶
type Handler struct { Writer http.ResponseWriter Request *http.Request Method string ResCode int ResHeaders map[string][]string ResData interface{} // contains filtered or unexported fields }
func (*Handler) GetFileParam ¶
func (this *Handler) GetFileParam(key string) (f *MultipartFileData)
func (*Handler) GetFileParams ¶
func (this *Handler) GetFileParams() map[string]*MultipartFileData
func (*Handler) GetGetParam ¶
func (*Handler) GetGetParamMap ¶
func (*Handler) GetHeaderArr ¶
func (*Handler) GetHeaders ¶
func (*Handler) GetPostIntParam ¶
func (*Handler) GetPostParam ¶
func (*Handler) GetPostParams ¶
func (*Handler) GetPostStrParam ¶
func (*Handler) GetRouterPath ¶
func (*Handler) GetRouterPathAt ¶
func (*Handler) NoResponse ¶
func (this *Handler) NoResponse()
func (*Handler) ParseParams ¶
func (*Handler) ResponseAccessCrossOrigin ¶
func (*Handler) ResponseData ¶
func (this *Handler) ResponseData(data interface{})
func (*Handler) ResponseHeaders ¶
func (*Handler) ResponseNothing ¶
func (*Handler) ResponseOK ¶
func (this *Handler) ResponseOK()
func (*Handler) ResponseStatus ¶
func (*Handler) WriteString ¶
type HttpServer ¶
type HttpServer struct { IsLog bool // contains filtered or unexported fields }
func (*HttpServer) AddFileRouter ¶
func (*HttpServer) AddGZipStaticRouter ¶
func (this *HttpServer) AddGZipStaticRouter(routerName, folder string, openCache bool, suffixes ...string)
func (*HttpServer) AddRouter ¶
func (this *HttpServer) AddRouter(httpPath string, handlerBuilder func() IHandler)
func (*HttpServer) AddStaticRouter ¶
func (this *HttpServer) AddStaticRouter(routerName, folder string)
func (*HttpServer) AsyncRun ¶
func (this *HttpServer) AsyncRun(port int) chan error
func (*HttpServer) Close ¶
func (this *HttpServer) Close() error
func (*HttpServer) RouterRunWithTimeout ¶
func (this *HttpServer) RouterRunWithTimeout(port int, readTimeout, writeTimeout time.Duration) error
func (*HttpServer) Run ¶
func (this *HttpServer) Run(port int) error
type MultipartFileData ¶
type Stream ¶
type Stream struct { Reader io.ReadCloser BuffSize int }
Click to show internal directories.
Click to hide internal directories.