我从 Apache Wink Web 服务向位于云中的外部资源发送请求(我无法将证书放入 JVM),并且我知道当我尝试从浏览器发出请求时,我得到了正确的答案.
String serviceURL = "https://someurl&ciUser=user&ciPassword=password";
ClientConfig clientConfig = new ClientConfig();
clientConfig.setBypassHostnameVerification(true);
RestClient client = new RestClient(clientConfig);
Resource resource = client.resource(serviceURL);
但我得到以下异常:
[err] org.apache.wink.client.ClientRuntimeException: java.lang.RuntimeException: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
[err] at org.apache.wink.client.internal.ResourceImpl.invoke(ResourceImpl.java:240)
[err] at org.apache.wink.client.internal.ResourceImpl.invoke(ResourceImpl.java:189)
[err] at org.apache.wink.client.internal.ResourceImpl.get(ResourceImpl.java:302)
更新
我也试试这个但得到同样的错误
String serviceURL = "https://url&ciUser=user&ciPassword=password";
//Perform basic http auth
ClientConfig clientConfig = new ClientConfig();
BasicAuthSecurityHandler basicAuthSecurityHandler = new BasicAuthSecurityHandler("user", "password");
clientConfig.handlers(basicAuthSecurityHandler);
RestClient client = new RestClient(clientConfig);
有可能解决这个问题吗?