带有特殊字符的用户名的 Camel SFTP

Camel SFTP with username with special characters

在 Camel (2.15.0) 中这样调用 SFTP (docs):

String uri = "sftp://foo.co.uk?username=Me+Admin&privateKeyFile=/my/id_rsa&knownHostsFile=/my/known_hosts&preferredAuthentications=publickey"
producerTemplate.sendBodyAndHeader(uri, fileContents, "CamelFileName", fullFilePath);

用户 Me Admin 的 SFTP 尝试结果。显然 + 被 space 取代。
我试图url编码这个(Me%2DAdmin),仍然被space(Me Admin)取代。
尝试对其进行编码两次,现在 SFTP 尝试用于用户名 Me%2DAdmin.
任何人都知道如何为用户名中带有 + 的用户将 Camel 获取到 SFTP?谢谢。

好的,回答我自己的问题,将请求 url 从 sftp://host?username=user 更改为 sftp://user@host 可以解决问题。用户名仍需编码一次:

String uri = "sftp://Me%2DAdmin@foo.co.uk?privateKeyFile=/my/id_rsa&knownHostsFile=/my/known_hosts&preferredAuthentications=publickey"
producerTemplate.sendBodyAndHeader(uri, fileContents, "CamelFileName", fullFilePath);

用 RAW() 标签包围 username/password 总是好的。例如 sftp:user@hostname?password=RAW(password@123)