Code:
<int-http:outbound-gateway
request-channel="http-requests"
extract-request-payload="true"
charset="UTF-8"
request-factory="template-client-factory"
url="${gateway.url}?{request}"
message-converters="http-template-message-converters"
http-method="GET"
expected-response-type="java.lang.String"
reply-channel="http-replies">
<int-http:uri-variable name="request" expression="headers['criteria-request']"/>
</int-http:outbound-gateway>
<bean id="template-client" class="org.apache.commons.httpclient.HttpClient">
<constructor-arg ref="http-template-client-params"/>
</bean>
<bean id="template-client-factory" class="org.springframework.http.client.CommonsClientHttpRequestFactory">
<constructor-arg ref="rim-template-client"/>
</bean>
<bean id="template-credentials" class="org.apache.commons.httpclient.UsernamePasswordCredentials">
<constructor-arg value="${gateway.username}"/>
<constructor-arg value="${gateway.password}"/>
</bean>
and now :
Code:
factory.getHttpClient().getState().setCredentials(AuthScope.ANY, credentials);