List of usage examples for org.springframework.web.reactive.function.client ClientResponse body
<T> T body(BodyExtractor<T, ? super ClientHttpResponse> extractor);
From source file:org.springframework.cloud.gateway.filter.WebClientWriteResponseFilter.java
@Override public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) { // NOTICE: nothing in "pre" filter stage as CLIENT_RESPONSE_ATTR is not added // until the WebHandler is run return chain.filter(exchange).then(Mono.defer(() -> { ClientResponse clientResponse = exchange.getAttribute(CLIENT_RESPONSE_ATTR); if (clientResponse == null) { return Mono.empty(); }/*from w w w . j a v a2s .co m*/ log.trace("WebClientWriteResponseFilter start"); ServerHttpResponse response = exchange.getResponse(); return response.writeWith(clientResponse.body(BodyExtractors.toDataBuffers())) .log("webClient response"); })); }