Apache Camel HTTPS4组件生成普通的HTTP请求

时间:2014-12-08 10:56:24

标签: java tomcat ssl https apache-camel

我正在尝试使用以下代码段在路由构建器类中配置https4组件:

@Override
public void configure() throws Exception {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource("C:/dev/cascerts/my.jks");
    ksp.setPassword("mypass");

    TrustManagersParameters tmp = new TrustManagersParameters();
    tmp.setKeyStore(ksp);

    SSLContextParameters scp = new SSLContextParameters();
    scp.setTrustManagers(tmp);

    HttpComponent httpComponent = getContext().getComponent("https4", HttpComponent.class);
    httpComponent.setSslContextParameters(scp);

    from("timer://foo?fixedRate=true&period=10s")
        .setHeader(Exchange.HTTP_METHOD, constant(HttpMethods.GET))
        .setHeader(Exchange.HTTP_QUERY, constant("page=" + this.page))
        .to("https4://hostname:8444/resourceuri?bridgeEndpoint=true&throwExceptionOnFailure=false")
        .process(this.new InventoryResponseProcessor());
}

但服务器以 400响应:普通HTTP请求已发送到HTTPS端口。 好像https4组件正在生成普通的http请求。我做错了什么?

Camel版本:2.13.2,应用程序在apache tomcat 8.0.14上运行

提前谢谢

0 个答案:

没有答案