【问题标题】:How does Apache Camel support ASCII mode file transfer with SFTP?Apache Camel 如何通过 SFTP 支持 ASCII 模式文件传输?
【发布时间】:2021-05-06 14:25:05
【问题描述】:

Apache Camel SFTP 实现使用 JSch。但是 JSCH 只支持二进制文件传输,我从这个链接了解到:
How to set file type and file transfer mode in JSch?

那么Camel SFTP如何支持binary作为URI参数呢?
https://camel.apache.org/components/latest/sftp-component.html

我的理解有错吗?

【问题讨论】:

    标签: java apache-camel sftp jsch


    【解决方案1】:

    文档很可能是错误的。

    • FtpEndpointConfigurerSftpEndpointConfigurer 确实将binary 参数分别传播到FtpConfiguration.setBinarySftpConfiguration.setBinary。所以从这个意义上说,两者都支持那个参数。

    • 但是当FtpOperations 查询FtpConfiguration.isBinary 并相应地设置FtpClient 模式时:

      client.setFileType(configuration.isBinary() ? FTP.BINARY_FILE_TYPE : FTP.ASCII_FILE_TYPE);
      
    • ...SftpConfiguration.isBinary 永远不会被调用。所以配置的值永远不会被使用。

    【讨论】:

    • 哦!好的,文档具有误导性。因此,camel ftp 实现使用 apache commons ftp 客户端,因此支持这两种模式。而骆驼 sftp 使用 jsch 并且只有二进制模式。非常感谢!
    猜你喜欢
    • 1970-01-01
    • 2015-08-04
    • 2018-01-07
    • 2017-11-21
    • 2015-09-17
    • 2019-08-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多