apache-commons-vfs

Java SFTP (apache vfs2) - password with @

怎甘沉沦 提交于 2019-12-11 07:55:39
问题 I'm trying to use the org.apache.commons.vfs2 to download a file via SFTP. The problem is, the password contains the '@' char, so this causes the URI to be parsed incorrectly: org.apache.commons.vfs2.FileSystemException: Expecting / to follow the hostname in URI Does anyone has an idea how to get around this issue? (I can't change the password, obviously). This is the code I'm using: String sftpUri = "sftp://" + userName + ":" + password + "@" + remoteServerAddress + "/" + remoteDirectory +

Specific file monitor using Apache Commons VFS API

大城市里の小女人 提交于 2019-12-11 01:18:05
问题 I want to perform some operation after a file named (XXXXXX.txt) created in the specific directory. I just don't want to monitor the whole directory. How can i achieve this using Apache Commons VFS API? I tried with the below code, but it did not work out. Any idea about how to achieve this? FileObject listendir1 = fsManager.resolveFile("C:\\Users\\Myname\\AppData\\Local\\Temp\\XXXXXXX.txt"); fileMonitor.addFile(listendir1); fileMonitor.start(); 回答1: Try something like this: FileSystemManager

Apache Commons VFS - cannot resolveFile

旧街凉风 提交于 2019-12-10 21:26:57
问题 The VFS method cannot process this URI ${jboss.server.temp.dir}/local/outgoing configured in jboss-beans.xml which is resolved to "C:\\Download\\jboss-eap-5.1.1\\server\\default\\tmp/local/outgoing" by JBoss. When I try to resolve the URI and get the file, it throws an exception. Any ideas what could be the problem? Exception 17:35:25,024 ERROR [VfsSynchronizerConfImpl] File FromOutgoing cannot be resolved, FileSystemException: org.apache.commons.vfs2.FileSystemException: Could not find file

Convert a FileObject into a File

徘徊边缘 提交于 2019-12-10 12:38:06
问题 I'm using Apache Commons VFS2 (Virtual File System) to monitor change file in directory. org.apache.commons.vfs2.FileListener return org.apache.commons.vfs2.FileObject . How Convert a org.apache.commons.vfs2.FileObject into a java.io.File 回答1: You can use new File(fileobject.getName().getPath()); Note that a VFS file object does not necessarily references a real File, it can also reference a file within a zip file for example. Depends on the resolver you used to obtain a file object.

How to use apache vfs2 for sftp with public-private-key and without password

陌路散爱 提交于 2019-12-09 04:51:42
问题 Currently I am using apache vfs2 to download files from a sftp. For authentication I use user-name and password. Is there a way to use vfs2 only with public-private-keys and without a password? I think I have use this function,but how? Set it only to "yes"? SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(options, "no"); This is my current code (snippet): private boolean downloadFile(){ StandardFileSystemManager sysManager = new StandardFileSystemManager(); //download der

Trying to set up Amazon S3 filesystem in Apache Commons VFS in java

非 Y 不嫁゛ 提交于 2019-12-08 04:28:23
问题 I'm trying to use VFS S3 a plugin for the Apache Commons VFS for Amazon S3. I've included the jar and it's recognising the s3 schema. However when I try to open a file (which is public, I can open it on my web browser), I get this error: Could not create a file system manager of class "org.apache.commons.vfs.impl.StandardFileSystemManager". >> org.apache.commons.vfs.VFS.createManager(VFS.java:93) >> org.apache.commons.vfs.VFS.getManager(VFS.java:47) What should I do? 回答1: I've fixed this

How do I use JCIFS with apache VFS to access an SMB URL?

倾然丶 夕夏残阳落幕 提交于 2019-12-04 03:19:27
问题 I am trying to access a folder on my local computer using an smb URL. my project is using the jars: commons-vfs2-2.0.jar and jcifs-1.3.17.jar (and all the other required jars). The code in it's entirety is: public static void main(String[] args) throws FileSystemException { jcifs.Config.registerSmbURLHandler(); StaticUserAuthenticator auth = new StaticUserAuthenticator(<domain>,<user>,<password>); FileSystemOptions opts = new FileSystemOptions(); DefaultFileSystemConfigBuilder.getInstance()

How to use apache vfs2 for sftp with public-private-key and without password

≡放荡痞女 提交于 2019-12-03 03:44:29
Currently I am using apache vfs2 to download files from a sftp. For authentication I use user-name and password. Is there a way to use vfs2 only with public-private-keys and without a password? I think I have use this function,but how? Set it only to "yes"? SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(options, "no"); This is my current code (snippet): private boolean downloadFile(){ StandardFileSystemManager sysManager = new StandardFileSystemManager(); //download der Datei try { sysManager.init(); FileObject localFile = sysManager.resolveFile(localFilePath); FileObject

How do I use JCIFS with apache VFS to access an SMB URL?

余生颓废 提交于 2019-12-01 17:18:17
I am trying to access a folder on my local computer using an smb URL. my project is using the jars: commons-vfs2-2.0.jar and jcifs-1.3.17.jar (and all the other required jars). The code in it's entirety is: public static void main(String[] args) throws FileSystemException { jcifs.Config.registerSmbURLHandler(); StaticUserAuthenticator auth = new StaticUserAuthenticator(<domain>,<user>,<password>); FileSystemOptions opts = new FileSystemOptions(); DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, auth); FileSystemManager fs = VFS.getManager(); FileObject smbFile = fs

How to set KEX on JSch Session when using Apache VFS

若如初见. 提交于 2019-12-01 06:41:59
I am using Apache VFS 2.1 with JSch 0.1.54 (latest versions today) to upload files using SFTP. The system throws "End of IO Stream Read" when connecting, the complete stack is: Caused by: com.jcraft.jsch.JSchException: Session.connect: java.io.IOException: End of IO Stream Read at com.jcraft.jsch.Session.connect(Session.java:565) at com.jcraft.jsch.Session.connect(Session.java:183) at org.apache.commons.vfs2.provider.sftp.SftpClientFactory.createConnection(SftpClientFactory.java:166) I've found a possible solution to my problem in this thread but it operates directly with the JSch. Since I am