Documentation ¶
Index ¶
- type Connector
- type Container
- type ContentTypeManager
- type Controller
- type ControllerFunc
- type DefaultContentTypeManager
- type EngineConnection
- type ErrorController
- type GroupController
- type Interceptor
- type InterceptorRegistration
- type InterceptorRegistry
- type MainResponder
- type NetworkConnection
- type Responder
- type ResponderRegistration
- type ResponderRegistry
- type Response
- type StaticWebResourcesController
- type WebContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connector ¶
type Connector interface { Connect(h http.Handler) (NetworkConnection, error) Enabled() bool }
Connector 是服务连接器的接口
type Container ¶
type Container interface { GetName() string // `inject:"${server.name}"` GetConnectors() []Connector // `inject:".web-server-connector"` GetContexts() []WebContext // `inject:".web-context"` GetContentTypes() ContentTypeManager // `inject:"#gin-web-content-types"` GetIndexPages() string // `inject:"${web.static.index-pages}"` GetIndexPageNames() []string // `inject:"${web.static.index-pages}"` Shutdown() error }
Container 表示一个web容器(gin-glass)
type ContentTypeManager ¶
ContentTypeManager ...
type Controller ¶
type Controller interface {
Init(ec EngineConnection) error
}
Controller 接口表示一个gin-glass控制器。 可以通过【inject:".rest-controller"】 或【inject:".static-web-controller"】注入
type ControllerFunc ¶ added in v0.0.14
type ControllerFunc func(ec EngineConnection) error
ControllerFunc 提供一个面向函数的控制器接口
type DefaultContentTypeManager ¶
type DefaultContentTypeManager struct { markup.Component `id:"gin-web-content-types"` AppContext application.Context `inject:"context"` TypesProperties string `inject:"${web.static.content-types-properties}"` // contains filtered or unexported fields }
DefaultContentTypeManager ...
func (*DefaultContentTypeManager) Find ¶
func (inst *DefaultContentTypeManager) Find(name string) string
Find 根据文件名查找相应的content-type
type EngineConnection ¶
type EngineConnection interface { // 取 WebContext GetWebContext() WebContext // 映射到新的路径 RequestMapping(path string) EngineConnection // 注册过滤器 Filter(order int, handler gin.HandlerFunc) // 注册处理器 Handle(method string, path string, handler gin.HandlerFunc) // 注册 error 处理器 HandleNoMethod(order int, handler gin.HandlerFunc) // 注册 error 处理器 HandleNoResource(order int, handler gin.HandlerFunc) }
EngineConnection 表示与gin.Engine 之间的连接
type ErrorController ¶
type ErrorController struct { markup.Component `class:"static-web-controller"` ResourcePath string `inject:"${web.error-page.resource}"` ContentType string `inject:"${web.error-page.content-type}"` Status int `inject:"${web.error-page.status}"` Container Container `inject:"#gin-web-container"` Context application.Context `inject:"context"` // contains filtered or unexported fields }
ErrorController ...
func (*ErrorController) Init ¶
func (inst *ErrorController) Init(ec EngineConnection) error
Init ...
type GroupController ¶ added in v0.0.14
type GroupController struct {
// contains filtered or unexported fields
}
GroupController 将一组 ControllerFunc 封装成一个 Controller 对象
func (*GroupController) AddController ¶ added in v0.0.14
func (inst *GroupController) AddController(ctr Controller)
AddController 添加一个 Controller 到group
func (*GroupController) AddFunction ¶ added in v0.0.14
func (inst *GroupController) AddFunction(fn ControllerFunc)
AddFunction 添加一个func到group
func (*GroupController) Init ¶ added in v0.0.14
func (inst *GroupController) Init(ec EngineConnection) error
Init 初始化
type Interceptor ¶ added in v0.1.1
type Interceptor interface { // input: 目标handler , output: 目标的代理 Intercept(h gin.HandlerFunc) gin.HandlerFunc }
Interceptor ...
type InterceptorRegistration ¶ added in v0.1.1
type InterceptorRegistration struct { Name string Order int Interceptor Interceptor }
InterceptorRegistration ...
type InterceptorRegistry ¶ added in v0.1.1
type InterceptorRegistry interface {
GetRegistrationList() []*InterceptorRegistration
}
InterceptorRegistry ... 通过【inject:".rest-interceptor-registry"】 或者【inject:".static-web-interceptor-registry"】注入
type MainResponder ¶ added in v0.1.2
MainResponder ... 【inject:"#glass-main-responder"】
type NetworkConnection ¶ added in v0.1.0
NetworkConnection 表示 gin.Engine 与网络之间的连接
type ResponderRegistration ¶ added in v0.1.2
ResponderRegistration ...
type ResponderRegistry ¶ added in v0.1.2
type ResponderRegistry interface {
GetRegistrationList() []*ResponderRegistration
}
ResponderRegistry ... 【inject:".glass-responder-registry"】
type StaticWebResourcesController ¶
type StaticWebResourcesController struct { markup.Component `class:"static-web-controller"` // 这 Root 是一个资源路径,指向 static-www 文件夹 `inject:"${web.static.root}"` Root string `inject:"${web.static.root}"` Container Container `inject:"#gin-web-container"` Context application.Context `inject:"context"` }
StaticWebResourcesController ...
func (*StaticWebResourcesController) Init ¶
func (inst *StaticWebResourcesController) Init(ec EngineConnection) error
Init ...
type WebContext ¶
type WebContext interface { GetContextID() string GetContainer() Container GetContextPath() string GetControllers() []Controller GetInterceptors() []InterceptorRegistry }
WebContext 表示一个web上下文(service)