aamingaa commented on issue #11725:
URL: https://github.com/apache/dubbo/issues/11725#issuecomment-1462282529

   > 
   
   
因为这个protocol是从consumerUrl里取的,当没有进行远程调用时,consumerUrl不会进行设置,所以第一次getServerContext取到的protocol为空。你可以这样调整下顺序,第一次就不为空了:
   
       userService.loginService(userInfo)
       RpcContext context = RpcContext.getServerContext();
       System.out.println("rest接口");
       System.out.println(context.getProtocol());
       System.out.println(context.getRemoteAddressString());
       System.out.println("-----------------------------------------");
       String userInfo = serverHttpRequest.getHeaders().getFirst(USERINFO);
       return userService.loginService(userInfo);


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to