Hi,

I want to copy files through https. The source URL has listing of directories 
enabled.

I made some test code to copy files. Ultimately, I want to do this:

            FileSystemManager fsManager = VFS.getManager();
            FileObject fileObject = fsManager.resolveFile( 
"https://localhost:8443/"; );
            FileContent content = fileObject.getContent();
            FileContentInfo contentInfo = content.getContentInfo();
            FileObject fileObjectDest = fsManager.resolveFile( "c:/temp/" );
            fileObjectDest.createFolder();
            fileObjectDest.copyFrom(fileObject, Selectors.SELECT_ALL);

However, this makes a file out of mu c:/temp directory.

So, then I tried this:
            FileSystemManager fsManager = VFS.getManager();
            // FileObject fileObject = fsManager.resolveFile( 
"https://localhost:8443/index.html"; );
            FileObject fileObject = fsManager.resolveFile( 
"https://localhost:8443/"; );
            FileContent content = fileObject.getContent();
            FileContentInfo contentInfo = content.getContentInfo();
            System.out.println(contentInfo.toString());
            FileObject fileObjectDest = fsManager.resolveFile( "c:/temp/" );
            fileObjectDest.createFolder();
            System.out.println(fileObjectDest.getType().toString());
            FileObject[] list = fileObject.findFiles(new 
MyFileSelector(".*\\.html"));
            for (FileObject file : list)
            {
                  System.out.println(file.getName());
            }

But I do not get any files in my list.

Then, I tried this:

            list = fileObject.getChildren();

And now I get an exception
Exception in thread "main" org.apache.commons.vfs.FileSystemException: Could 
not list the contents of "https://localhost:8443/"; because it is not a folder.
What I would like to achieve, can this be done by Apache VFS?
If yes, where do I need to make the changes to get this working?
Regards,

Richard Kooijman

Reply via email to