我正在使用的网站是HTTPS协议的网站,因此我想使用ighore证书。但是我无法设置忽略证书。
public class JoddHttpClientDemoApplication {
public static void main(String[] args) throws Exception {
SpringApplication.run(JoddHttpClientDemoApplication.class, args);
HttpRequest request = HttpRequest.get("https://xxxxx.com?0.6891255003788694").
header("Referer","https://xxxxx.com/x.jsp");
HttpResponse response = request.send();
System.out.println(response);
}
}
我有这样的错误,
jodd.http.httpexception:sun.security.validator.validatorexception:pkix路径构建失败
切换到最新的jodd v3.8.1。在那里您有以下方法:trustAllCerts
。它将信任所有证书:)使用这样的使用:
HttpRequest
.get("https://xxxxx.com?0.6891255003788694")
.header("Referer","https://xxxxx.com/x.jsp")
.trustAllCerts(true);