问题描述
(骆驼2.9.2)
非常简单的用例,但是我似乎找不到答案.我的代码可以归结为:
Very simple use case, but I can't seem to find the answer. My code boils down to this:
String user = "user";
String password = "foo&bar";
String uri = "smtp://hostname:25?username=" + user +
"&password=" + password +
"&[email protected]"; // etc. You get the idea
from("seda:queue:myqueue").to(uri);
Camel抛出带有未知参数= [{bar = null}]"的ResolveEndpointFailedException.
Camel throws a ResolveEndpointFailedException with "Unknown parameters=[{bar=null}]."
如果我尝试"foo%26bar",我将得到相同的结果.
If I try "foo%26bar," I get the same result.
如果我尝试使用"foo& amp; bar",骆驼会以未知参数= [{{amp; bar = null}]"作为响应."
If I try "foo&bar" camel responds with "Unknown parameters=[{amp;bar=null}]."
我尝试使用URISupport创建URI.它逃脱了&到%26,然后再次得到未知参数= [{bar = null}]".
I tried using URISupport to create the URI. It escapes the & to %26, and then I get "Unknown parameters=[{bar=null}]" again.
有什么想法吗?
推荐答案
从Camel 2.11开始,您可以使用原始语法
As from Camel 2.11 you could use raw syntax
例如:
.to("ftp:[email protected]?password=RAW(se+re?t&23)&binary=true"
https://cwiki.apache.org/融合/显示/CAMEL/如何+做+ I +配置+端点
这篇关于骆驼(Camel):如何在URI中将“&"作为数据(不作为分隔符)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!