这样构建您的客户
HostnameVerifier hostnameVerifier = HttpsURLConnection.getDefaultHostnameVerifier();ClientConfig config = new DefaultClientConfig();SSLContext ctx = SSLContext.getInstance("SSL");ctx.init(null, myTrustManager, null);config.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, new HTTPSProperties(hostnameVerifier, ctx));Client client = Client.create(config);从此博客文章中窃取了更多详细信息:http
:
//blogs.oracle.com/enterprisetechtips/entry/consumption_restful_web_services_with
有关设置证书的信息,请参见以下已很好回答的SO问题:在Java中将HTTPS与REST一起使用



