NewServerHandler xxx
(name string, handlerChainBuilder HandlerChainBuilderFn, notFoundHandler http.Handler)
| 56 | |
| 57 | // NewServerHandler xxx |
| 58 | func 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 | |
| 80 | type director struct { |
| 81 | name string |
no test coverage detected