You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Zhijuan Mao <zh...@gmail.com> on 2007/07/18 22:50:56 UTC

[commons-vfs] issues in http?

Hi All:

I am having a new question regarding http in vfs. Basically I would
like to use vfs to upload a local file to a web server.

I seem to be able to resolve a file object when passing in a http url.  eg.
String path = "http://test.com/testfile";
FileObject myFile = VFS.getManager().resolveFile(path);

But I cannot seem to do a copyFile for this File object eg:
myFile.copyFrom(localFileObject, Selectors.SELECT_ALL);

It always throws me the following exception:

Caused by: org.apache.commons.vfs.FileSystemException: Could not
create folder "http://test.com/testfile" because it already exists and
is a
 file.
        at org.apache.commons.vfs.provider.AbstractFileObject.createFolder(AbstractFileObject.java:848)
        at org.apache.commons.vfs.provider.AbstractFileObject.createFolder(AbstractFileObject.java:859)
        at com.dolby.nlps.agents.fileio.FileTransferAgent.process(FileTransferAgent.java:110)
        ... 13 more

Can anyone please let me know what is wrong with it?

Thanks a lot!

Joanne

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [commons-vfs] issues in http?

Posted by Sergey Vladimirov <vl...@gmail.com>.
Good day, Joanne.

It's not possible to upload files to webserver by HTTP protocol using VFS.
Try use FTP (SFTP) or WebDAV protocols.

-- 
Sergey


2007/7/19, Zhijuan Mao <zh...@gmail.com>:
>
> Hi All:
>
> I am having a new question regarding http in vfs. Basically I would
> like to use vfs to upload a local file to a web server.
>
> I seem to be able to resolve a file object when passing in a http
> url.  eg.
> String path = "http://test.com/testfile";
> FileObject myFile = VFS.getManager().resolveFile(path);
>
> But I cannot seem to do a copyFile for this File object eg:
> myFile.copyFrom(localFileObject, Selectors.SELECT_ALL);
>
> It always throws me the following exception:
>
> Caused by: org.apache.commons.vfs.FileSystemException: Could not
> create folder "http://test.com/testfile" because it already exists and
> is a
> file.
>        at org.apache.commons.vfs.provider.AbstractFileObject.createFolder(
> AbstractFileObject.java:848)
>        at org.apache.commons.vfs.provider.AbstractFileObject.createFolder(
> AbstractFileObject.java:859)
>        at com.dolby.nlps.agents.fileio.FileTransferAgent.process(
> FileTransferAgent.java:110)
>        ... 13 more
>
> Can anyone please let me know what is wrong with it?
>
> Thanks a lot!
>
> Joanne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>


-- 
Sergey Vladimirov