-
Notifications
You must be signed in to change notification settings - Fork 822
Closed
Description
客户端代码如下
`
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
文档这里描述的不是很清晰,我服务端的写法是照着文档写的,建议文档能安招从客户端-》服务端的过程来描述
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels