Spring Boot SSL客户端

Spring Boot SSL客户端,第1张

Spring Boot SSL客户端

我无法让Andy提交上述客户工作。我不断收到错误消息,说“ localhost!= clientname”。无论如何,我让它正常工作。

 import java.io.IOException; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpException; import org.apache.commons.httpclient.URI; import org.apache.commons.httpclient.methods.GetMethod; public class SSLClient {      static        {          System.setProperty("javax.net.ssl.trustStore","c:/apachekeys/client1.jks");          System.setProperty("javax.net.ssl.trustStorePassword", "password");          System.setProperty("javax.net.ssl.keyStore", "c:/apachekeys/client1.jks");          System.setProperty("javax.net.ssl.keyStorePassword", "password");       }     public static void main(String[] args) throws HttpException, IOException {         HttpClient client = new HttpClient();         GetMethod method = new GetMethod();         method.setURI(new URI("https://localhost:8443/restserver", false));         client.executeMethod(method);         System.out.println(method.getResponseBodyAsString());     } }


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5585995.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-14
下一篇 2022-12-14

发表评论

登录后才能评论

评论列表(0条)

保存