commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank van der Kleij <kl...@hotmail.com>
Subject RE: [VFS] Retrieving directories with files using HTTPS
Date Mon, 14 Mar 2011 20:26:05 GMT

As far as I know you can't list files using the http or https filesystem implementation, just
copy single files for which you know the URL.
It would be a nice extension I agree...
Frank

> From: rkooijman@inergy.nl
> To: user@commons.apache.org
> Date: Mon, 14 Mar 2011 17:21:21 +0100
> Subject: [VFS] Retrieving directories with files using HTTPS
> 
> 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
> 
 		 	   		  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message