MCPcopy Create free account
hub / github.com/baidu/EasyFaaS / NewServerHandler

Function NewServerHandler

pkg/server/handler.go:58–78  ·  view source on GitHub ↗

NewServerHandler xxx

(name string, handlerChainBuilder HandlerChainBuilderFn, notFoundHandler http.Handler)

Source from the content-addressed store, hash-verified

56
57// NewServerHandler xxx
58func NewServerHandler(name string, handlerChainBuilder HandlerChainBuilderFn, notFoundHandler http.Handler) *ServerHandler {
59 nonGoRestfulMux := mux.NewPathRecorderMux(name)
60 if notFoundHandler != nil {
61 nonGoRestfulMux.NotFoundHandler(notFoundHandler)
62 }
63
64 gorestfulContainer := restful.NewContainer()
65 gorestfulContainer.ServeMux = http.NewServeMux()
66 gorestfulContainer.Router(restful.CurlyRouter{})
67 director := director{
68 name: name,
69 goRestfulContainer: gorestfulContainer,
70 nonGoRestfulMux: nonGoRestfulMux,
71 }
72 return &ServerHandler{
73 FullHandlerChain: handlerChainBuilder(director),
74 GoRestfulContainer: gorestfulContainer,
75 NonGoRestfulMux: nonGoRestfulMux,
76 Director: director,
77 }
78}
79
80type director struct {
81 name string

Callers 1

NewMethod · 0.85

Calls 2

NotFoundHandlerMethod · 0.95
NewPathRecorderMuxFunction · 0.92

Tested by

no test coverage detected