httpservice

package
v0.0.0-...-ff803ae Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

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

type CORSHeader struct {
	AllowCORSHeader map[string][]string
}

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 HttpRedirectData struct {
	Url        string
	CookieList []*http.Cookie
}

http redirect

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

type HttpService struct {
	service.Service
	// contains filtered or unexported fields
}

func (*HttpService) AddFiltrate

func (httpService *HttpService) AddFiltrate(FiltrateFun HttpFiltrate) bool

func (*HttpService) HttpEventHandler

func (httpService *HttpService) HttpEventHandler(ev *event.Event)

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)

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) Handle

func (slf *HttpSession) Handle()

func (*HttpSession) Query

func (slf *HttpSession) Query(key string) (string, bool)

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

Jump to

Keyboard shortcuts

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