go-restful核心代码逻辑
2020-09-18 22:33:16 13 举报
go-restful核心代码逻辑
作者其他创作
大纲/内容
route.postBuild()
serveMux.HandleFunc
c.matchesRouteByPathTokens
RouteBuilder.typeNameHandler
pathProcessor.ExtractParameters
c.addHandler
c.detectWebService
ws.Route(ws.GET(\"/\").To(xx))
route.Function
c.detectRoute
builder.Build()
RouteBuilder.Path
DefaultContainer = NewContainer()
选择匹配path的route
jsr311Router.detectRoute
init()
new(restful.WebService)
c.computeWebserviceScore
DefaultContainer.ServeMux = http.DefaultServeMux
builder.copyDefaults
加载go-restful包时,默认创建一个container
chain.ProcessFilter
tokenizePath
c.router.SelectRoute
sort.Sort(candidates)
c.selectRoutes
new(RouteBuilder)
restful.Add(ws)
内部关联http包的默认路由对象
注册的路由处理函数,在这里被执行
WebService.Route
route := Route{...}
WebService.GET
newPathExpression
RouteBuilder.To
c.dispatch
RouteBuilder.servicePath
选择匹配其他属性的最合适的一个route
append(c.webServices
DefaultContainer.Add(service)
RouteBuilder.Method
0 条评论
回复 删除
下一页