Commons VFS and Java.net.URL - Adding support for “sftp://” protocol

前端 未结 5 2166
梦如初夏
梦如初夏 2021-01-04 01:45

We\'re trying to use Apache Commons VFS to access something over SFTP. It claims to support SFTP, however we\'re getting a MalformedURLException when it starts. Digging arou

5条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-04 02:09

    I've never used VFS before, but it looks like you'd need to (at least) register an SFTP FileProvider. It looks like it requires something like:

    DefaultFileSystemManager fsm = ... /* Create and configure your FSM. */
    fsm.addProvider("sftp", new SftpFileProvider());
    

    There is probably a way to do the same thing through configuration file syntax.

提交回复
热议问题