【发布时间】:2018-07-12 19:29:45
【问题描述】:
您能否告诉我使用 Unirest 作为 REST 客户端禁用证书验证的方法。
我将 Unirest 与 Java Spring 结合使用。以下是我的源代码:
try {
HttpResponse<String> response = Unirest.post("myurl")
.header("content-type", "application/json")
.header("accept", "application/json")
.body("my json data here")
.asJson();
} catch (Exception e) {
logger.info("==================REST CLIENT ERROR: "+e.getMessage());
}
结果:
===================REST客户端错误:javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException:PKIX 路径构建失败: sun.security.provider.certpath.SunCertPathBuilderException:无法 找到请求目标的有效认证路径
【问题讨论】:
标签: java spring spring-boot unirest