...
This component provides access to remote file systems over the FTP, SFTP and WebDAV protocols.
This component is an extension of the File component.
URI format
Code Block |
---|
ftp://[username@]hostname[:port]/filename[?options] sftp://[username@]hostname[:port]/filename[?options] webdav://[username@]hostname[:port]/filename[?options] |
...
Name | Default Value | Description |
---|---|---|
directory | true | indicates whether or not the given file name should be interpreted by default as a directory or file (as it sometimes hard to be sure with some FTP servers) |
password | null | specifies the password to use to login to the remote file system |
binary | false | specifies the file transfer mode BINARY or ASCII. Default is ASCII. |
As this component is an extension to the File component the options from this parent component is also available.
Known issues
When consuming files (downloading) you must use type conversation to either String or to InputStream for ASCII and BINARY file types.
We will improve this in Camel 1.4 so it hopefully works out-of-the-box.
Also in Camel 1.3 there is a issue that you must explicitly set the filename using the setHeader expression when consuming from FTP directly to File.
The code below illustrates this:
Code Block |
---|
private String ftpUrl = "ftp://camelrider@localhost:21/public/downloads?password=admin&binary=false"; private String fileUrl = "file:myfolder/?append=false&noop=true"; return new RouteBuilder() { public void configure() throws Exception { from(ftpUrl).setHeader(FileComponent.HEADER_FILE_NAME, constant("downloaded.txt")).convertBodyTo(String.class).to(fileUrl); } }; |
Include Page | ||||
---|---|---|---|---|
|