camHttp

package
v0.5.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 camBase.ComponentConfigInterface)

init

func (*HttpComponent) Start

func (comp *HttpComponent) Start()

start

func (*HttpComponent) Stop

func (comp *HttpComponent) Stop()

stop

type HttpComponentConfig

type HttpComponentConfig struct {
	component.ComponentConfig
	camRouter.RouterPluginConfig
	camContext.ContextPluginConfig
	camSsl.SslPluginConfig
	camMiddleware.MiddlewarePluginConfig

	Port        uint16
	SessionName string
	SessionKey  string
	// contains filtered or unexported fields
}

http server config

func NewHttpComponentConfig

func NewHttpComponentConfig(port uint16) *HttpComponentConfig

new config

func (*HttpComponentConfig) AddRoute

func (config *HttpComponentConfig) AddRoute(route string, handler camBase.HttpRouteHandler)

add custom route handler. its priority is higher than the controller. Deprecated: remove on v0.5.0 It's not support middleware Instead: HttpComponentConfig.MiddlewarePluginConfig.AddRoute()

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) 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) 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
	// contains filtered or unexported fields
}

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() camBase.HttpContextInterface

Get HttpContextInterface

func (*HttpController) GetRequest deprecated

func (ctrl *HttpController) GetRequest() *http.Request

Deprecated: remove on v0.5.0 Instead: Please use context to implement camBase.ContextHttpInterface

func (*HttpController) GetRequestWriter deprecated

func (ctrl *HttpController) GetRequestWriter() *http.ResponseWriter

Deprecated: remove on v0.5.0 Instead: Please use context to implement camBase.ContextHttpInterface

type HttpControllerInterface

type HttpControllerInterface interface {
	// contains filtered or unexported methods
}

http controller interface Deprecated: remove on v0.5.0

type HttpSession

type HttpSession struct {
	camBase.SessionInterface
	// contains filtered or unexported fields
}

session

func NewHttpSession

func NewHttpSession(storeSession *sessions.Session) *HttpSession

func (*HttpSession) Del added in v0.4.0

func (sess *HttpSession) Del(key interface{})

del value by key

func (*HttpSession) Destroy

func (sess *HttpSession) Destroy()

destroy session

func (*HttpSession) Get

func (sess *HttpSession) Get(key interface{}) interface{}

get value by key

func (*HttpSession) GetSessionId

func (sess *HttpSession) GetSessionId() string

set sessionId

func (*HttpSession) Set

func (sess *HttpSession) Set(key interface{}, value interface{})

set key-value

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

func (uf *UploadFile) Close() error

Close io

func (*UploadFile) Extension

func (uf *UploadFile) Extension() string

file extension

func (*UploadFile) Filename

func (uf *UploadFile) Filename() string

filename

func (*UploadFile) Save

func (uf *UploadFile) Save(absFilename string) error

Save file absFilename

func (*UploadFile) Size

func (uf *UploadFile) Size() int64

file size

func (*UploadFile) Suffix

func (uf *UploadFile) Suffix() string

file suffix

Jump to

Keyboard shortcuts

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