How to override getVirtualUserDir() in Apache Mina sshd-core version 0.14.0

前端 未结 1 718
失恋的感觉
失恋的感觉 2020-12-18 12:44

I used Apache Mina sshd-core version 0.10.0.Due to some issues with file uploading i had to change version into 0.14.0.In there i can not override getVirtualUserDir() method

相关标签:
1条回答
  • 2020-12-18 13:13

    The purpose of the getVirtualUserDir in Mina SSHD 0.10.0 was to set an initial directory of the file system.

    In Mina SSHD 0.14.0 the same purpose is served by current parameter of NativeFileSystemView constructor:

    public NativeFileSystemView(String userName, Map<String, String> roots, String current)
    

    Note that the documentation claims not to call the constructor directly and use NativeFileSystemFactory instead. But the NativeFileSystemFactory never calls that overload of the constructor. Either the comment is obsolete or the factory is not finished yet.

    Or it's a typo and it should have actually referred to VirtualFileSystemFactory. What is the factory you probably should use instead of overriding NativeFileSystemFactory.

    sshd.setFileSystemFactory(new VirtualFileSystemFactory("C:/root"));
    
    0 讨论(0)
提交回复
热议问题