2013-03-26 58 views
0

對於我的開發機器,我想要禁用HTTPS連接的SSL主機名檢查。所散發出來的調度代碼例外情況是這樣的:斯卡拉調度:設置默認主機名驗證?

javax.net.ssl.SSLException: hostname in certificate didn't match: <localhost> != <*.mydomain.com> OR <*.mydomain.com> OR <mydomain.com> 
     at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:228) ~[httpclient-4.1.3.jar:4.1.3] 
     at org.apache.http.conn.ssl.BrowserCompatHostnameVerifier.verify(BrowserCompatHostnameVerifier.java:54) ~[httpclient-4.1.3.jar:4.1.3] 
     at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:149) ~[httpclient-4.1.3.jar:4.1.3] 
     at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:130) ~[httpclient-4.1.3.jar:4.1.3] 
     at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:397) ~[httpclient-4.1.3.jar:4.1.3] 
     at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:148) ~[httpclient-4.1.3.jar:4.1.3] 

我正在尋找一種方法來設置默認的主機名校驗在將被分派使用的方式。有a method on the deprecated HttpsURLConnection來設置默認的主機名驗證,但整個類顯然已被棄用。目前有沒有正確的方法來做到這一點?

回答