有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Restlet1。1示例\book\rest\ch2\Example2_5无用于HTTPS的客户端连接器

示例2_5为HTTPS创建一个客户端来处理请求

final Response response = new Client(Protocol.HTTPS).handle(request);

Restlet-1.1中唯一相关的jar是org.mortbay.jetty.https.jar,我将它添加到了我的运行时类路径中

然而,我在运行时

[java] WARNING: No available client connector supports the required protoco
ls: 'HTTPS' . Please add the JAR of a matching connector to your classpath.

虽然这是一个警告,但它会导致返回null

final DomRepresentation document = response.getEntityAsDom();

有人能够运行Restlet-1.1中的任何示例吗?这些示例是《RESTfulWeb服务》一书中Ruby示例的Restlet等价物

维塔利


共 (1) 个答案

  1. # 1 楼答案

    看看the Restlet connectors web page,没有用于HTTPS的Jetty客户端连接器

    使用“Net”连接器(基于java.net类),我能够获得更好的结果,这需要我将com.noelios.restlet.ext.net.jar文件添加到我的类路径中

    显然,Apache Commons HTTP客户端也支持HTTPS