本文整理了Java中org.springframework.web.reactive.function.client.WebClientResponseException.<init>()
方法的一些代码示例,展示了WebClientResponseException.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebClientResponseException.<init>()
方法的具体详情如下:
包路径:org.springframework.web.reactive.function.client.WebClientResponseException
类名称:WebClientResponseException
方法名:<init>
[英]Constructor with response data only, and a default message.
[中]构造函数,仅包含响应数据和默认消息。
代码示例来源:origin: spring-projects/spring-framework
return new WebClientResponseException(statusCode, statusText, headers, body, charset, request);
代码示例来源:origin: spring-projects/spring-integration
.defaultIfEmpty(new byte[0])
.map(bodyBytes -> {
throw new WebClientResponseException(
"ClientResponse has erroneous status code: "
+ httpStatus.value() + " "
代码示例来源:origin: com.vmware.card-connectors/core
public static Mono<ClientResponse> checkStatus(ClientResponse response, Predicate<HttpStatus> statusPredicate) {
if (statusPredicate.test(response.statusCode())) {
return Mono.just(response);
}
Charset charset = response.headers().contentType()
.map(MimeType::getCharset)
.orElse(StandardCharsets.ISO_8859_1);
return response.bodyToMono(byte[].class)
.flatMap(body -> Mono.error(new WebClientResponseException(
"Unexpected response",
response.statusCode().value(),
response.statusCode().getReasonPhrase(),
response.headers().asHttpHeaders(),
body,
charset
)));
}
内容来源于网络,如有侵权,请联系作者删除!