jodd http client How to set up Ignore certificates

682 views Asked by At

The site i am using is that of a https protocol,so i want to use Ignore certificates.But I am unable to set the ignore certificate.

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);
    }
}

I am getting an error like this,

jodd.http.HttpException: sun.security.validator.ValidatorException: PKIX path building failed

1

There are 1 answers

1
igr On BEST ANSWER

Switch to newest Jodd v3.8.1. There you have the following method: trustAllCerts. It will trust all certificates :) Use it like this:

HttpRequest
    .get("https://xxxxx.com?0.6891255003788694")
    .header("Referer","https://xxxxx.com/x.jsp")
    .trustAllCerts(true);