dragon-zhang commented on issue #3025:
URL:
https://github.com/apache/incubator-shenyu/issues/3025#issuecomment-1064834313
```java
protected Mono<Void> doExecute(final ServerWebExchange exchange, final
ShenyuPluginChain chain, final SelectorData selector, final RuleData rule) {
Map<String, List<GeneralContextHandle>> generalContextHandleMap =
GeneralContextPluginDataHandler.CACHED_HANDLE.get().obtainHandle(CacheKeyUtils.INST.getKey(rule));
Map<String, Map<String, String>> generalContextMap = new HashMap<>();
HttpHeaders headers = exchange.getRequest().getHeaders();
generalContextHandleMap.forEach((rpcType, v) -> {
if (CollectionUtils.isEmpty(v)) {
return;
}
Map<String, String> generalContextMapWithRpcType = new
HashMap<>();
v.forEach(each -> {
if (StringUtils.isBlank(each.getGeneralContextType()) ||
StringUtils.isBlank(each.getGeneralContextKey())) {
return;
}
switch (each.getGeneralContextType()) {
case Constants.ADD_GENERAL_CONTEXT_TYPE:
generalContextMapWithRpcType.put(each.getGeneralContextKey(),
each.getGeneralContextValue());
break;
case Constants.TRANSMIT_HEADER_TO_GENERAL_CONTEXT_TYPE:
generalContextMapWithRpcType.put(StringUtils.isBlank(each.getGeneralContextValue())
? each.getGeneralContextKey() : each.getGeneralContextValue(),
//how about change to this ?
GsonUtils.getInstance().toJson(headers.get(each.getGeneralContextKey())));
break;
default:
break;
}
});
generalContextMap.put(rpcType, generalContextMapWithRpcType);
});
exchange.getAttributes().put(Constants.GENERAL_CONTEXT,
generalContextMap);
return chain.execute(exchange);
}
```
--
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]