We are trying to use the http outbound-gateway and it is working great; but need to go via a proxy.And the proxy needs authentications.
I found that spring configuration for http client is the following:
<bean id="requestFactory"
class="org.springframework.http.client.SimpleClientHttpRequestFactory">
<property name="proxy">
<bean id="proxy" class="java.net.Proxy">
<constructor-arg>
<util:constant static-field="java.net.Proxy.Type.HTTP"/>
</constructor-arg>
<constructor-arg>
<bean class="java.net.InetSocketAddress">
<constructor-arg value="123.0.0.1"/>
<constructor-arg value="8080"/>
</bean>
</constructor-arg>
</bean>
</property>
<int-http:outbound-gateway id="gtwy"
request-channel="channel.request" url="${url}"
http-method="POST" expected-response-type="java.lang.String" charset="UTF-8"
reply-timeout="${ws.reply.timeout}" reply-channel="channel.reply"
request-factory="requestFactory">
the same thing for sftp proxy.
For SFTP, I used SOCKS proxy :
<property name="user" value="${sftp.user}" />
<property name="privateKey" value="${sftp.private.keyfile}" />
<property name="privateKeyPassphrase" value="${sftp.passphrase}" />
<property name="allowUnknownKeys" value="true" />
<property name="proxy" ref="proxySocks5" />
</bean>
<bean id="proxySocks5" class="com.foo.ProxySOCKS5FactoryBean">
<constructor-arg value="${sftp.proxy.address}" />
<constructor-arg value="${sftp.proxy.port}" />
<constructor-arg value="${sftp.proxy.user}" />
<constructor-arg value="${sftp.proxy.pw}" />
Because i don't add host and port to DefaultSftpSessionFactory, an Exception occured, i think that it is useless to add host and port to SftpSessionFactory because i already add it to proxy.
Downloading files failedorg.springframework.messaging.MessagingException: Problem occurred while synchronizing remote to local directory; nested exception is org.springframework.messaging.MessagingException: Failed to obtain pooled item; nested exception is java.lang.IllegalArgumentException: host must not be empty