Java Code Examples for org.springframework.web.reactive.function.client.ExchangeFilterFunction#ofResponseProcessor()
The following examples show how to use
org.springframework.web.reactive.function.client.ExchangeFilterFunction#ofResponseProcessor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LogFilters.java From tutorials with MIT License | 6 votes |
private static ExchangeFilterFunction logResponse() { return ExchangeFilterFunction.ofResponseProcessor(clientResponse -> { if (log.isDebugEnabled()) { StringBuilder sb = new StringBuilder("Response: \n") .append("Status: ") .append(clientResponse.rawStatusCode()); clientResponse .headers() .asHttpHeaders() .forEach((key, value1) -> value1.forEach(value -> sb .append("\n") .append(key) .append(":") .append(value))); log.debug(sb.toString()); } return Mono.just(clientResponse); }); }
Example 2
Source File: SimpleWebClientConfiguration.java From blog-tutorials with MIT License | 5 votes |
private ExchangeFilterFunction logResponse() { return ExchangeFilterFunction.ofResponseProcessor(clientResponse -> { logger.info("Response: {}", clientResponse.statusCode()); clientResponse.headers().asHttpHeaders() .forEach((name, values) -> values.forEach(value -> logger.info("{}={}", name, value))); return Mono.just(clientResponse); }); }
Example 3
Source File: ResponseLoggingCustomizer.java From blog-tutorials with MIT License | 5 votes |
private ExchangeFilterFunction logResponse() { return ExchangeFilterFunction.ofResponseProcessor(clientResponse -> { logger.info("Response: {}", clientResponse.statusCode()); logger.info("--- Http Headers of Response: ---"); clientResponse.headers().asHttpHeaders() .forEach((name, values) -> values.forEach(value -> logger.info("{}={}", name, value))); return Mono.just(clientResponse); }); }
Example 4
Source File: WebClientTransportClientFactory.java From spring-cloud-netflix with Apache License 2.0 | 5 votes |
private ExchangeFilterFunction http4XxErrorExchangeFilterFunction() { return ExchangeFilterFunction.ofResponseProcessor(clientResponse -> { // literally 400 pass the tests, not 4xxClientError if (clientResponse.statusCode().value() == 400) { ClientResponse newResponse = ClientResponse.from(clientResponse) .statusCode(HttpStatus.OK).build(); newResponse.body((clientHttpResponse, context) -> { return clientHttpResponse.getBody(); }); return Mono.just(newResponse); } return Mono.just(clientResponse); }); }