[ 
https://issues.apache.org/activemq/browse/CAMEL-420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=42023#action_42023
 ] 

Claus Ibsen commented on CAMEL-420:
-----------------------------------

We are changing a default option on the FTPConsumer in Camel 1.4.

Camel 1.3
setNames=false

Camel 1.4
setNames=true


The issue is tracked in CAMEL-420.


The issue is that Camel in v1.3 or below does not default to use the filenames 
from the downloaded files from the FTP Server. So you as the end user have to 
explicity set a filename if you want to eg. store the downaloded file directly 
to a local file etc using the File component.

An example (Camel 1.3)
{code}
String fileUrl = "file:target/ftptest/?append=false&noop=true";
String ftpUrl =
"ftp://[EMAIL PROTECTED]:21/tmp3/camel?password=admin&binary=false";

from(ftpUrl).setHeader(FileComponent.HEADER_FILE_NAME,
constant("deleteme.txt")).
convertBodyTo(String.class).to(fileUrl);
{code}
In the example above we have to set an filename using the setHeader option with 
the special key FileComponent.HEADER_FILE_NAME

If we just want to use the filename from the FTP Server we have to do this in 
Camel 1.3. Set the setNames option to true. So the ftpUrl is:
{code}
String ftpUrl =
"ftp://[EMAIL PROTECTED]:21/tmp3/camel?password=admin&binary=false&consume
r.setNames=true";
{code}
In Camel 1.4 the default value of consumer.setNames is true as opposed to false 
in Camel 1.3

So in Camel 1.4 it works out of the box that Camel will use the filename from 
the FTP Server if you have not explicity set a new filename using the 
setHeader(FileComponent.HEADER_FILE_NAME, "mynewfilename.txt")

So the Camel 1.4 example is:
{code}
String fileUrl = "file:target/ftptest/?append=false&noop=true";
String ftpUrl =
"ftp://[EMAIL PROTECTED]:21/tmp3/camel?password=admin&binary=false";

from(ftpUrl).convertBodyTo(String.class).to(fileUrl);
{code}

> FTPComponent - problems and improvements
> ----------------------------------------
>
>                 Key: CAMEL-420
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-420
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-ftp
>    Affects Versions: 1.3.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 1.4.0
>
>
> See this forum:
> http://www.nabble.com/FTP-to-FILE-td16354813s22882.html
> Problems:
> - Using ASCII you need to use convertBodyTo(String.class) to let it work out 
> of the box 
> - Using BINARY we need some Type Converters to let it consume files from a 
> FTP Server and store it as a File *Fixed*
> - You have to set the filename using the header in the configuration 
> otherwise the filename can be wrong *Fixed*

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to