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

How to use Apache httpclient-win in a Camel route within an OSGi container?

我正在尝试使用 Apache httpclient-win 获取受 Windows 身份验证保护的 IIS 托管 Web 资源。我设法在没有身份验证的情况下使用了 Camel HTTP4 组件。我还成功地通过直接 Java 代码使用 httpclient-win 进行身份验证。但是现在,我很难弄清楚如何在 OSGi 容器 (ServiceMix) 中托管的 Camel 路由中使用 httpclient-win。

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

你到底有什么问题?

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

        <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>