2015-11-24 68 views
0

在駱駝(2.15.0)用戶名調用到SFTP(docs)爲這樣:駱駝SFTP與特殊字符

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); 

在SFTP嘗試結果用戶Me Admin。顯然+被一個空格所取代。
我試圖對此進行網址編碼(Me%2DAdmin),仍然用空格替換(Me Admin)。
試圖將其編碼兩次,現在SFTP嘗試用戶名爲Me%2DAdmin
任何人都有一個想法如何讓駱駝到用戶名爲+的用戶的SFTP?謝謝。

回答

0

好的回答我自己的問題,將請求網址從sftp://host?username=user更改爲sftp://[email protected]可以解決問題。用戶名仍需要進行一次編碼:

String uri = "sftp://Me%[email protected]?privateKeyFile=/my/id_rsa&knownHostsFile=/my/known_hosts&preferredAuthentications=publickey" 
producerTemplate.sendBodyAndHeader(uri, fileContents, "CamelFileName", fullFilePath); 
+0

看到這裏如何配置密碼的URI,http://camel.apache.org/how-do-i-configure-endpoints.html –