Documentation ¶
Index ¶
- func NewCacheStore(cachePrefix string) *cacheStore
- type HttpComponent
- type HttpComponentConfig
- type HttpContext
- func (ctx *HttpContext) Close()
- func (ctx *HttpContext) CloseHandler(handler func())
- func (ctx *HttpContext) DelCookie(name string)
- func (ctx *HttpContext) GetCookie(name string) *http.Cookie
- func (ctx *HttpContext) GetCookieValue(name string) string
- func (ctx *HttpContext) GetHttpRequest() *http.Request
- func (ctx *HttpContext) GetHttpResponseWriter() http.ResponseWriter
- func (ctx *HttpContext) SetCookie(cookie *http.Cookie)
- func (ctx *HttpContext) SetCookieValue(name string, value string)
- func (ctx *HttpContext) SetHttpRequest(request *http.Request)
- func (ctx *HttpContext) SetHttpResponseWriter(responseWriter http.ResponseWriter)
- type HttpController
- type HttpSession
- func (sess *HttpSession) Del(key string)
- func (sess *HttpSession) Destroy()
- func (sess *HttpSession) Get(key string) interface{}
- func (sess *HttpSession) GetSessionId() string
- func (sess *HttpSession) Set(key string, value interface{})
- func (sess *HttpSession) SetDestroyHandler(handler func())
- func (sess *HttpSession) Values() map[string]interface{}
- type HttpSessionInterface
- type SessionOption
- type SessionStoreManager
- type Store
- type UploadFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCacheStore ¶ added in v0.4.3
func NewCacheStore(cachePrefix string) *cacheStore
Types ¶
type HttpComponent ¶
type HttpComponent struct { component.Component camRouter.RouterPlugin camContext.ContextPlugin camMiddleware.MiddlewarePlugin // contains filtered or unexported fields }
http server component
func (*HttpComponent) Init ¶
func (comp *HttpComponent) Init(configI camStatics.ComponentConfigInterface)
init
type HttpComponentConfig ¶
type HttpComponentConfig struct { component.ComponentConfig camRouter.RouterPluginConfig camContext.ContextPluginConfig camTls.TlsPluginConfig camMiddleware.MiddlewarePluginConfig Port uint16 // contains filtered or unexported fields }
http server config
func NewHttpComponentConfig ¶
func NewHttpComponentConfig(port uint16) *HttpComponentConfig
new config
func (*HttpComponentConfig) SetSessionOption ¶ added in v0.4.3
func (conf *HttpComponentConfig) SetSessionOption(opt *SessionOption)
func (*HttpComponentConfig) SetSessionStore ¶ added in v0.4.3
func (conf *HttpComponentConfig) SetSessionStore(store Store)
type HttpContext ¶ added in v0.4.1
type HttpContext struct { camContext.Context // contains filtered or unexported fields }
func (*HttpContext) Close ¶ added in v0.4.1
func (ctx *HttpContext) Close()
func (*HttpContext) CloseHandler ¶ added in v0.4.1
func (ctx *HttpContext) CloseHandler(handler func())
func (*HttpContext) DelCookie ¶ added in v0.4.3
func (ctx *HttpContext) DelCookie(name string)
func (*HttpContext) GetCookie ¶ added in v0.4.3
func (ctx *HttpContext) GetCookie(name string) *http.Cookie
func (*HttpContext) GetCookieValue ¶ added in v0.4.3
func (ctx *HttpContext) GetCookieValue(name string) string
func (*HttpContext) GetHttpRequest ¶ added in v0.4.1
func (ctx *HttpContext) GetHttpRequest() *http.Request
func (*HttpContext) GetHttpResponseWriter ¶ added in v0.4.1
func (ctx *HttpContext) GetHttpResponseWriter() http.ResponseWriter
func (*HttpContext) SetCookie ¶ added in v0.4.3
func (ctx *HttpContext) SetCookie(cookie *http.Cookie)
func (*HttpContext) SetCookieValue ¶ added in v0.4.3
func (ctx *HttpContext) SetCookieValue(name string, value string)
func (*HttpContext) SetHttpRequest ¶ added in v0.4.1
func (ctx *HttpContext) SetHttpRequest(request *http.Request)
func (*HttpContext) SetHttpResponseWriter ¶ added in v0.4.1
func (ctx *HttpContext) SetHttpResponseWriter(responseWriter http.ResponseWriter)
type HttpController ¶
type HttpController struct {
camRouter.Controller
}
http controller
func (*HttpController) GetFile ¶
func (ctrl *HttpController) GetFile(key string) *UploadFile
Get upload file call UploadFile.Save(...) if you want to save the upload file
func (*HttpController) GetHttpContext ¶ added in v0.4.1
func (ctrl *HttpController) GetHttpContext() camStatics.HttpContextInterface
Get HttpContextInterface
type HttpSession ¶
type HttpSession struct { camStatics.SessionInterface // contains filtered or unexported fields }
session
func (*HttpSession) SetDestroyHandler ¶ added in v0.4.4
func (sess *HttpSession) SetDestroyHandler(handler func())
func (*HttpSession) Values ¶ added in v0.4.3
func (sess *HttpSession) Values() map[string]interface{}
type HttpSessionInterface ¶ added in v0.4.3
type HttpSessionInterface interface { // get sessionId GetSessionId() string // set key-value in session Set(key string, value interface{}) // get value by key Get(key string) interface{} // delete value by key Del(key string) // get all values in session Values() map[string]interface{} // destroy session Destroy() }
type SessionOption ¶ added in v0.4.3
type SessionStoreManager ¶ added in v0.4.3
type SessionStoreManager struct {
// contains filtered or unexported fields
}
func NewSessionStoreManager ¶ added in v0.4.3
func NewSessionStoreManager(store Store, option *SessionOption) *SessionStoreManager
func (*SessionStoreManager) GetSession ¶ added in v0.4.3
func (m *SessionStoreManager) GetSession(ctx camStatics.HttpContextInterface) (HttpSessionInterface, error)
get session or new by Context
type Store ¶ added in v0.4.3
type Store interface { SetSessionOption(opt *SessionOption) // Create one if not exists Get(sessId string) (HttpSessionInterface, error) Save(sessI HttpSessionInterface) error Del(sessI HttpSessionInterface) error }
type UploadFile ¶
type UploadFile struct { File multipart.File Header *multipart.FileHeader }
UploadFile helper
func NewUploadFile ¶
func NewUploadFile(file multipart.File, Header *multipart.FileHeader) *UploadFile
New UploadFile instance
func (*UploadFile) Save ¶
func (uf *UploadFile) Save(absFilename string) error
Save file absFilename
Click to show internal directories.
Click to hide internal directories.