This commit is contained in:
crusader 2018-04-12 19:03:32 +09:00
parent 5fddc23005
commit 5c581b97f8

View File

@ -10,7 +10,7 @@ import (
"git.loafle.net/commons/server-go" "git.loafle.net/commons/server-go"
csw "git.loafle.net/commons/server-go/web" csw "git.loafle.net/commons/server-go/web"
cswf "git.loafle.net/commons/server-go/web/fasthttp" cswf "git.loafle.net/commons/server-go/web/fasthttp"
oca "git.loafle.net/overflow/commons-go/annotation" occa "git.loafle.net/overflow/commons-go/core/annotation"
"github.com/valyala/fasthttp" "github.com/valyala/fasthttp"
) )
@ -137,19 +137,19 @@ func (s *RESTServlets) RegisterRESTServices(services []interface{}) error {
LOOP: LOOP:
for _, service := range services { for _, service := range services {
t := reflect.TypeOf(service) t := reflect.TypeOf(service)
ta := cdr.GetTypeAnnotation(t, oca.RESTServiceAnnotationType) ta := cdr.GetTypeAnnotation(t, occa.RESTServiceAnnotationType)
if nil == ta { if nil == ta {
return fmt.Errorf("Service[%s] is not RESTService, use @RESTService", t.Elem().Name()) 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) mas := cdr.GetMethodAnnotations(t, occa.RequestMappingAnnotationType)
if nil == mas || 0 == len(mas) { if nil == mas || 0 == len(mas) {
continue LOOP continue LOOP
} }
for methodName, v := range mas { for methodName, v := range mas {
ma := v.(*oca.RequestMappingAnnotation) ma := v.(*occa.RequestMappingAnnotation)
mm, ok := s.methodMapping[ma.Method] mm, ok := s.methodMapping[ma.Method]
if !ok { if !ok {
mm = make(map[string]*MethodMapping) mm = make(map[string]*MethodMapping)