如何在OSGi容器中的Camel路由中使用Apache httpclient-win?

时间:2015-11-21 19:04:32

标签: apache-camel osgi apache-httpclient-4.x apache-servicemix

我正在尝试使用Apache httpclient-win来获取由Windows身份验证保护的IIS托管的Web资源。我已经设法使用Camel HTTP4组件而无需身份验证。我还设法使用httpclient-win和直接Java代码成功进行身份验证。但是现在,我很难弄清楚如何在OSGi容器(ServiceMix)中托管的Camel路由中使用httpclient-win。

2 个答案:

答案 0 :(得分:0)

我设法创建了一个OSGi包,它通过将此部分添加到我的POM文件中来嵌入httpclient-win所需的依赖项:

        <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <version>2.3.7</version>
            <extensions>true</extensions>
            <configuration>
                <instructions>
                    <Bundle-SymbolicName>BundleName</Bundle-SymbolicName>
                    <Embed-Dependency>httpclient|httpcore|httpclient-win|jna|jna-platform;scope=compile|runtime|provided</Embed-Dependency>
                    <Embed-Transitive>true</Embed-Transitive>
                </instructions>
            </configuration>
        </plugin>

答案 1 :(得分:-1)

我还没有完成安全部分,但是将http,netty4和restlet部署到Apache Karaf这是一个OSGI容器。

你究竟有什么问题?