HTTPS using Jersey Client

后端 未结 5 1871
遇见更好的自我
遇见更好的自我 2020-11-28 21:18

How do I send GET requests using the Jersey Client API to a server which runs on the HTTPS protocol. Is there any sample code that I can use ?

5条回答
  •  北荒
    北荒 (楼主)
    2020-11-28 21:58

    For Jersey 2 you'd need to modify the code:

            return ClientBuilder.newBuilder()
                .withConfig(config)
                .hostnameVerifier(new TrustAllHostNameVerifier())
                .sslContext(ctx)
                .build();
    

    https://gist.github.com/JAlexoid/b15dba31e5919586ae51 http://www.panz.in/2015/06/jersey2https.html

提交回复
热议问题