我正在使用camel-ftp,但在连接到 FTP 服务器的目录名称中使用德语变音符号(例如 Ö)时遇到问题。我无法重命名该目录,因为它是公司的工作目录。
我使用camel.version:2.18.1和camel-ftp.version:2.18.1。
我配置了以下路由(在路由中我定义了包含 Ö 的 unicode 字符 \u00d6 变音符号的目录):
from(ftp://user@hostname:21/etc/\u00d6ffentlicherOrdner/test?password=pwd).routeId("kurse").to(...)
错误信息:
Consumer FtpConsumer[ftp://user@hostname:21/etc//0�ffentlicherOrdner/test?password=xxxxxx]
failed polling endpoint: ftp://ftp://user@hostname:21/etc/0�ffentlicherOrdner/test?password=xxxxxx.
Will try again at next poll.
Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException -
File operation failed: 550 �ffentlicherOrdner: Das System kann die angegebene Datei nicht finden.
当我使用以下参数扩展路线时:
&ftpClient.controlEncoding=ISO-8859-15
&charset=ISO-8859-15
&consumer.bridgeErrorHandler=true
然后我得到的输出表明一切似乎都很好,因为我没有收到任何错误消息:
Route: kurse started and consuming from: ftp://user@hostname:21/etc/ÖffentlicherOrdner/test?charset=ISO-8859-1&consumer.bridgeErrorHandler=true&ftpClient.controlEncoding=ISO-8859-1&password=xxxxxx
但现在没有文件被轮询。我在测试目录中有一些文件,但是当我启动该进程时,它不会将文件推送到端点。
我不明白为什么它不消耗文件?也许编码仍然是错误的?
EDIT:
我对编码太执着了,以至于错过了检查 FTP 属性。
我的问题的解决方案是设置passiveMode:
&passiveMode=true