我写过使用“愚蠢”的X509TrustManager和HostnameVerifier的Jersey RESTful客户端,以信任我们实验室系统上的所有自签名SSL证书,以便更轻松地处理证书。
ClientConfig config = new DefaultClientConfig();
SSLContext context = null;
try
{
context = SSLContext.getInstance("SSL");
context.init(null,
new TrustManager[] { new DumbX509TrustManager() },
null);
config.getProperties()
.put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES,
new HTTPSProperties(this.getHostnameVerifier(),
context));
webClient = Client.create(config);
}
....
有没有办法使用CXF做类似的事情?