【问题标题】:HTTPS Requests with ClientResource带有 ClientResource 的 HTTPS 请求
【发布时间】:2016-08-23 22:19:40
【问题描述】:

当我为 http 创建请求时,它适用于:

ClientResource resource = new ClientResource(protocol + "://localhost:" + port + path);

但是,当我创建 httpsrequests 时,我收到了这个错误:

Starting the internal [HTTPS/1.1] server on port 8081
Starting the internal HTTP client
A recoverable error was detected (1001), attempting again in 2000 ms.
A recoverable error was detected (1001), attempting again in 2000 ms.
Stopping the internal server

我知道当我们使用Client 对象时,我们应该设置:

Client client = new Client(Protocol.HTTPS);

所以,我怀疑为ClientResource 设置类似的东西。我试过了,但没有解决:

resource.setProtocol(Protocol.HTTPS);

也试过了:

Client client = new Client(Protocol.HTTPS);
resource.setProtocol(Protocol.HTTPS);
resource.setNext(client);

但是我得到了相同的日志。从日志中可以看出,它首先创建了一个 HTTPS 服务器而不是 HTTP 客户端。

有什么想法吗?

【问题讨论】:

    标签: java restlet


    【解决方案1】:

    问题与证书有关。我已经设置了一个信任密钥库并将其用于我的示例。

    【讨论】:

      猜你喜欢
      • 2018-06-14
      • 2012-02-06
      • 2018-03-11
      • 2013-12-01
      • 2019-07-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多