five111 opened a new issue #2596:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2596


   客户端代码如下
   `
               CseHttpEntity<?> entity = new CseHttpEntity<>(null);
               InvocationContext invocationContext = new InvocationContext();
               invocationContext.addContext("aaa", "bbb");
               entity.setContext(invocationContext);
               UUID uuid = UUID.randomUUID();
               System.out.println(formatter.format(new Date())+uuid);
               ResponseEntity<String> responseEntity =
                       restTemplate.getForEntity(url + uuid, String.class, 
entity)
   `
   我想将aaa传递至服务端
   服务端对应接口如下
   `
       @GetMapping("/hello/{name}")
       public String sayHello(@PathVariable("name") @Length String name, 
InvocationContext invocationContext) throws InterruptedException {
           System.out.println(invocationContext.getContext().get("aaa"));
           System.out.println(formatter.format(new Date())+ " " +name);
           return name+", hello";
       }
   `
   这里无法获取到上下文的值
   请问这个值该如何正确传递和获取
   
https://servicecomb.apache.org/references/java-chassis/zh_CN/build-provider/context-param.html
   文档这里描述的不是很清晰,我服务端的写法是照着文档写的,建议文档能安招从客户端-》服务端的过程来描述


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


Reply via email to