use of com.mendmix.gateway.filter.post.RewriteBodyServerHttpResponse in project jeesuite-libs by vakinge.
the class AbstracResponseFilter method filter.
@Override
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
//
if (exchange.getAttribute(GatewayConstants.CONTEXT_IGNORE_FILTER) != null) {
return chain.filter(exchange);
}
if (RuequestHelper.isWebSocketRequest(exchange.getRequest())) {
return chain.filter(exchange);
}
//
BizSystemModule module = RuequestHelper.getCurrentModule(exchange);
RewriteBodyServerHttpResponse newResponse = new RewriteBodyServerHttpResponse(exchange, module);
return chain.filter(exchange.mutate().response(newResponse).build()).then(Mono.fromRunnable(() -> {
Long start = exchange.getAttribute(GatewayConstants.CONTEXT_REQUEST_START_TIME);
if (logger.isDebugEnabled() && start != null) {
logger.debug(">request_time_trace -> uri:{},useTime:{} ms", exchange.getRequest().getPath().value(), (System.currentTimeMillis() - start));
}
}));
}
Aggregations