Announcement Announcement Module
No announcement yet.
DefaultFtpSessionFactory and Proxy Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • DefaultFtpSessionFactory and Proxy

    I need to FTP to a site through a proxy and I see that DefaultSftpSessionFactory supports a proxy but DefaultFtpSessionFactory does not.

    1) Why the inconsistency?
    2) Is there a way to get DefaultFtpSessionFactory to use a proxy
    3) If there is a way, how would I do it (other than "Just write your own version")?

  • #2
    There is actually nothing inconsistent about it. The SFTP uses different library that has an explicit proxy setting where FTP uses commons-net which uses different mechanism to connect through proxy. You can read more here: Scroll down to "Does FTPClient support FTP connections through an FTP proxy server?" as well as

    Basically all you need to do is set two system properties before creating ApplicationContext.
    For example one way of doing it would be:
    System.getProperties().put( "socksProxyPort", "1080");
    System.getProperties().put( "socksProxyHost" ,"");
    ApplicationContext context = . . .


    • #3
      Thanks for the info!

      Question: Won't this proxy anything that uses commons-net then? I only want the proxy for this one external FTP connection as I have other FTP connections to other internal servers that do not need to go through our proxy.


      • #4
        No, its per JVM instance unless other FTP connections are part of the same JVM instance.


        • #5
          They will be part of the same JVM. I have multiple FTP connections to various servers (internal and external) occurring within the same execution.

          I'm looking at using the ProxyFtpSessionFactory that was in a previous post that you commented on:

          If it works I think it would be a good addition to a future release of Spring Integration.


          • #6
            Could you please raise a JIRA Improvement request We might have to change the underlying library if commons-net is not supporting it.