use of org.springframework.cloud.gateway.filter.NettyRoutingFilter in project LinkAgent by shulieTech.
the class GatewayFilterChainFilterInterceptor method beforeFirst.
@Override
public void beforeFirst(Advice advice) {
final NettyRoutingFilter target = (NettyRoutingFilter) advice.getTarget();
final Object[] parameterArray = advice.getParameterArray();
ServerWebExchange exchange = (ServerWebExchange) parameterArray[0];
final InvokeContext context = exchange.getAttribute(SpringCloudGatewayConstants.GATEWAY_CONTEXT);
if (context == null || context.isEmpty()) {
return;
}
Pradar.setInvokeContext(context);
if (!target.getHeadersFilters().contains(requestHttpHeadersFilter)) {
target.getHeadersFilters().add(requestHttpHeadersFilter);
}
if (!target.getHeadersFilters().contains(responseHttpHeadersFilter)) {
target.getHeadersFilters().add(responseHttpHeadersFilter);
}
}
Aggregations