如何使Apache Camel Restlet生成器忽略SSL主机名验证

时间:2014-10-09 16:25:30

标签: java ssl apache-camel apache-httpclient-4.x restlet

我正在使用Apache Camel的Restlet组件,我有一条连接到使用自签名证书公开的https URL的路由。

使用-Djavax.net.ssl.trustStore我解决了与不受信任的证书相关的问题,但此时我仍坚持使用主机名验证。

以下是stacktrace的摘录,您可以看到 Apache Camel Restlet组件使用 Restlet 库,该库最终使用 Apache Http Client

javax.net.ssl.SSLException: hostname in certificate didn't match: <192.168.1.1> != <localhost>
    at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:231)
    at org.apache.http.conn.ssl.BrowserCompatHostnameVerifier.verify(BrowserCompatHostnameVerifier.java:54)
    at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:152)
    ...
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
    at org.restlet.ext.httpclient.internal.HttpMethodCall.sendRequest(HttpMethodCall.java:347)
    ...
    at org.apache.camel.component.restlet.RestletProducer.process(RestletProducer.java:87)
    at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:120)

问题如下:有没有办法在Restlet或Apache Http Client上使用系统属性或某种静态方法禁用主机名验证?

0 个答案:

没有答案