在Spring DSL中,Camel的HTTP4组件如何配置为使用NTLM身份验证?
我能够使用Spring DSL配置成功配置Camel的HTTP组件以使用NTLM身份验证:
<!-- Works: HTTP (3) Configuration -->
<bean id="httpConfig" class="org.apache.camel.component.http.HttpConfiguration">
<property name="authMethod" value="NTLM"/>
<property name="authHost" value="my-active-directory-host"/>
<property name="authDomain" value="my-ad-domain"/>
<property name="authUsername" value="my-username"/>
<property name="authPassword" value="my-password"/>
</bean>
<!-- Works: HTTP (3) Component-->
<bean id="httpmw" class="org.apache.camel.component.http.HttpComponent">
<property name="camelContext" ref="camel"/>
<property name="httpConfiguration" ref="httpConfig"/>
</bean>
但是,我最好尝试配置HTTP4组件失败,因为我不知道如何设置HttpComponent的httpClientConfiguration。或许,还有另一种方法来连接HTTP4组件?
<!-- Works: HTTP4 Configuration -->
<bean id="httpClientConfig" class="org.apache.camel.component.http.NTLMAuthenticationHttpClientConfigurer">
<constructor-arg name="proxy" value="false"/>
<constructor-arg name="user" value="my-username"/>
<constructor-arg name="pwd" value="my-password"/>
<constructor-arg name="domain" value="my-ad-domain"/>
<constructor-arg name="host" value="my-active-directory-host"/>
</bean>
<!-- Does not work: HTTP4 Component, exception
Caused by: org.springframework.beans.NotWritablePropertyException:
Invalid property 'httpClientConfiguration' of bean class [org.apache.camel.component.http4.HttpComponent]:
Bean property 'httpClientConfiguration' is not writable or has an invalid setter method.
Does the parameter type of the setter match the return type of the getter?
-->
<bean id="http4mw" class="org.apache.camel.component.http4.HttpComponent">
<property name="camelContext" ref="camel"/>
<property name="httpClientConfiguration" ref="httpClientConfig"/>
</bean>