You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2019/10/08 09:14:07 UTC

[GitHub] [servicecomb-service-center] tianxiaoliang commented on a change in pull request #592: [SCB-1512] Allow custom handler chain.

tianxiaoliang commented on a change in pull request #592: [SCB-1512] Allow custom handler chain.
URL: https://github.com/apache/servicecomb-service-center/pull/592#discussion_r332409728
 
 

 ##########
 File path: pkg/rest/route.go
 ##########
 @@ -48,20 +52,74 @@ type Route struct {
 	Func func(w http.ResponseWriter, r *http.Request)
 }
 
-// HTTP request multiplexer
+// ROAServantService defines a group of Routes
+type ROAServantService interface {
+	URLPatterns() []Route
+}
+
+// ROAServerHandler is a HTTP request multiplexer
 // Attention:
 //   1. not thread-safe, must be initialized completely before serve http request
 //   2. redirect not supported
 type ROAServerHandler struct {
-	handlers map[string][]*urlPatternHandler
+	handlers  map[string][]*urlPatternHandler
+	chainName string
 }
 
+// NewROAServerHander news an ROAServerHandler
 func NewROAServerHander() *ROAServerHandler {
 	return &ROAServerHandler{
 		handlers: make(map[string][]*urlPatternHandler),
 	}
 }
 
+// RegisterServant registers a ROAServantService
+// servant must be an pointer to service object
+func (this *ROAServerHandler) RegisterServant(servant interface{}) {
 
 Review comment:
   this -> short name

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services