* spring-cloud-gateway traceid does not transmit #3411 skywalking-version:6.5.0 spring-gateway-version:2.1.2 Error Description: Customize the filter, traceid does not transmit. "ServerWebExchangeDecorator" is a transport chain,His structure should be like this: serverWebExchangeDecorator -----(ServerWebExchangeDecorator)delegate ------(ServerWebExchangeDecorator)delegate ------..... -----(DefaultServerWebExchange)delegate In the current source code, there is no deep search, but only the next level. When there are multiple custom filters, you get an error. Repair method: Look for "delegate" of "ServerWebExchangeDecorator" recursively until "DefaultServerWebExchange" * spring-boot-webflux traceid does not transmit #3411 spring-boot-starter-webflux-version:2.1.6 Error Description: Customize the filter, traceid does not transmit. "ServerWebExchangeDecorator" is a transport chain,His structure should be like this: serverWebExchangeDecorator -----(ServerWebExchangeDecorator)delegate ------(ServerWebExchangeDecorator)delegate ------..... -----(DefaultServerWebExchange)delegate In the current source code, there is no deep search, but only the next level. When there are multiple custom filters, you get an error. Repair method: Look for "delegate" of "ServerWebExchangeDecorator" recursively until "DefaultServerWebExchange" * checkStyle
This commit is contained in:
parent
e1ce6edfab
commit
96b2baaddb
|
|
@ -82,13 +82,25 @@ public class DispatcherHandlerHandleMethodInterceptor implements InstanceMethods
|
|||
public static EnhancedInstance getInstance(Object o) {
|
||||
EnhancedInstance instance = null;
|
||||
if (o instanceof ServerWebExchangeDecorator) {
|
||||
ServerWebExchange delegate = ((ServerWebExchangeDecorator) o).getDelegate();
|
||||
if (delegate instanceof DefaultServerWebExchange) {
|
||||
instance = (EnhancedInstance) delegate;
|
||||
}
|
||||
instance = getEnhancedInstance((ServerWebExchangeDecorator) o);
|
||||
} else if (o instanceof DefaultServerWebExchange) {
|
||||
instance = (EnhancedInstance) o;
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
private static EnhancedInstance getEnhancedInstance(ServerWebExchangeDecorator serverWebExchangeDecorator) {
|
||||
Object o = serverWebExchangeDecorator.getDelegate();
|
||||
if (o instanceof ServerWebExchangeDecorator) {
|
||||
return getEnhancedInstance((ServerWebExchangeDecorator) o);
|
||||
} else if (o instanceof DefaultServerWebExchange) {
|
||||
return (EnhancedInstance) o;
|
||||
} else if (o == null) {
|
||||
throw new NullPointerException("The expected class DefaultServerWebExchange is null");
|
||||
} else {
|
||||
throw new RuntimeException("Unknown parameter types:" + o.getClass());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,13 +79,24 @@ public class NettyRoutingFilterInterceptor implements InstanceMethodsAroundInter
|
|||
public static EnhancedInstance getInstance(Object o) {
|
||||
EnhancedInstance instance = null;
|
||||
if (o instanceof ServerWebExchangeDecorator) {
|
||||
ServerWebExchange delegate = ((ServerWebExchangeDecorator) o).getDelegate();
|
||||
if (delegate instanceof DefaultServerWebExchange) {
|
||||
instance = (EnhancedInstance) delegate;
|
||||
}
|
||||
instance = getEnhancedInstance((ServerWebExchangeDecorator) o);
|
||||
} else if (o instanceof DefaultServerWebExchange) {
|
||||
instance = (EnhancedInstance) o;
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
private static EnhancedInstance getEnhancedInstance(ServerWebExchangeDecorator serverWebExchangeDecorator) {
|
||||
Object o = serverWebExchangeDecorator.getDelegate();
|
||||
if (o instanceof ServerWebExchangeDecorator) {
|
||||
return getEnhancedInstance((ServerWebExchangeDecorator) o);
|
||||
} else if (o instanceof DefaultServerWebExchange) {
|
||||
return (EnhancedInstance) o;
|
||||
} else if (o == null) {
|
||||
throw new NullPointerException("The expected class DefaultServerWebExchange is null");
|
||||
} else {
|
||||
throw new RuntimeException("Unknown parameter types:" + o.getClass());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue