diff --git a/servlet/rest-servlet.go b/servlet/rest-servlet.go index 63796c9..eb6c4c5 100644 --- a/servlet/rest-servlet.go +++ b/servlet/rest-servlet.go @@ -27,17 +27,17 @@ type RESTServlet interface { type RESTServlets struct { cswf.Servlets - RESTRegistry crr.RESTRegistry + restRegistry crr.RESTRegistry - MethodMapping map[string]map[string]*MethodMapping + methodMapping map[string]map[string]*MethodMapping } func (s *RESTServlets) Init(serverCtx server.ServerCtx) error { if err := s.Servlets.Init(serverCtx); nil != err { return err } - if nil == s.MethodMapping { - s.MethodMapping = make(map[string]map[string]*MethodMapping) + if nil == s.methodMapping { + s.methodMapping = make(map[string]map[string]*MethodMapping) } return nil @@ -47,7 +47,7 @@ func (s *RESTServlets) Handle(servletCtx server.ServletCtx, ctx *fasthttp.Reques method := string(ctx.Method()) path := string(ctx.Path()) - es, ok := s.MethodMapping[method] + es, ok := s.methodMapping[method] if !ok { return csw.NewError(fasthttp.StatusNotFound, fmt.Errorf("Not Found for [%s]%s", method, path)) } @@ -83,7 +83,7 @@ func (s *RESTServlets) HandleGet(servletCtx server.ServletCtx, ctx *fasthttp.Req } } - _, err := s.RESTRegistry.Invoke(mapping.Method, params, servletCtx, ctx) + _, err := s.restRegistry.Invoke(mapping.Method, params, servletCtx, ctx) if nil != err { return csw.NewError(fasthttp.StatusInternalServerError, err) @@ -109,7 +109,7 @@ func (s *RESTServlets) HandlePost(servletCtx server.ServletCtx, ctx *fasthttp.Re } } - _, err := s.RESTRegistry.Invoke(mapping.Method, params, servletCtx, ctx) + _, err := s.restRegistry.Invoke(mapping.Method, params, servletCtx, ctx) if nil != err { return csw.NewError(fasthttp.StatusInternalServerError, err) @@ -123,8 +123,8 @@ func (s *RESTServlets) RegisterRESTServices(services []interface{}) error { return nil } - s.MethodMapping = make(map[string]map[string]*MethodMapping) - s.RESTRegistry = crr.NewRESTRegistry() + s.methodMapping = make(map[string]map[string]*MethodMapping) + s.restRegistry = crr.NewRESTRegistry() LOOP: for _, service := range services { @@ -133,7 +133,7 @@ LOOP: if nil == ta { return fmt.Errorf("Service[%s] is not RESTService, use @RESTService", t.Elem().Name()) } - s.RESTRegistry.RegisterService(service, "") + s.restRegistry.RegisterService(service, "") mas := cdr.GetMethodAnnotations(t, oca.RequestMappingAnnotationType) if nil == mas || 0 == len(mas) { @@ -142,10 +142,10 @@ LOOP: for methodName, v := range mas { ma := v.(*oca.RequestMappingAnnotation) - mm, ok := s.MethodMapping[ma.Method] + mm, ok := s.methodMapping[ma.Method] if !ok { mm = make(map[string]*MethodMapping) - s.MethodMapping[ma.Method] = mm + s.methodMapping[ma.Method] = mm } _, ok = mm[ma.Entry]