webcenter

package
v0.0.0-...-4dc1fac Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterWebPlugin

func RegisterWebPlugin(pluginName string, p WebPlugin)

注册Web插件初始化 , 由WebCenter执行 Web插件的初始化设置

Types

type FuncWebPluginInit

type FuncWebPluginInit func(*WebCenter) error

Web 插件初始化函数

type WebCenter

type WebCenter struct {
	// contains filtered or unexported fields
}

func GetWebCenter

func GetWebCenter() *WebCenter

func (*WebCenter) GetHttpHandler

func (w *WebCenter) GetHttpHandler() http.Handler

该函数只能执行一次

func (*WebCenter) Init

func (w *WebCenter) Init()

初始化设置, 执行各webPlugin的初始化函数

func (*WebCenter) RegisterWebHandler

func (w *WebCenter) RegisterWebHandler(serviceName string, h interface{})

注册服务对应的处理函数

func (*WebCenter) RegisterWebPlugin

func (w *WebCenter) RegisterWebPlugin(serviceName string, p WebPlugin)

注册web插件 注册服务对应的处理函数

func (*WebCenter) Run

func (w *WebCenter) Run(addr string)

func (*WebCenter) SetHttpRoute

func (w *WebCenter) SetHttpRoute(httpMethod string, party string, path string, service string)

设置Http路由, method 为static 表示静态目录

func (*WebCenter) Start

func (w *WebCenter) Start()

func (*WebCenter) Stop

func (w *WebCenter) Stop()

type WebPlugin

type WebPlugin interface {
	Register(wc *WebCenter) //向webcenter 注册
}

type WebRoute

type WebRoute struct {
	Method string //多个方法使用空格分隔
	// method 为static 时, selector 表示 静态目录
	Selector string // 表示 服务名或静态目录
	// 表示服务名时, 服务名必须内部注册才有效
	Party string // 分组路由, 如果有, 实际URL 应该为/Party/Path
	Path  string // 路由地址
}

Jump to

Keyboard shortcuts

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