我正在尝试对以下网址进行获取请求:
http://hellostackexchange?mynameiskees.json
问题是我没有看到在将查询参数添加到uri后如何添加选项参数。我的尝试如下:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<route id="hello stackexchange">
<from uri="timer://counting_camera?fixedRate=true&period=1000" />
<setHeader headerName="CamelHttpQuery">
<simple>"mynameiskees.json"</simple>
</setHeader>
<to uri=http4://hellostackexchange/>
<to uri = "direct:test"/>
</route>
<route id = "final">
<from uri="direct:test?authUsername=kees&authPassword=kees"/>
<to uri="log:result"/>
</route>
</camelContext>
这会导致错误:
There are 2 parameters that couldn't be set on the endpoint. Check the uri
if the parameters are spelt correctly and that they are properties of the
endpoint. Unknown parameters=[{authPassword=kees, authUsername=kees}]
关于如何做到这一点的任何提示?
在@Namphibian的帮助下,我执行了以下操作,您只需将查询参数添加到标题中,并将选项添加到您的uri:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<route id="hello stackexchange">
<from uri="timer://counting_camera?fixedRate=true&period=1000" />
<setHeader headerName="CamelHttpQuery">
<simple>"mynameiskees.json"</simple>
</setHeader>
<to uri="http4://hellostackexchange?authUsername=kees&authPassword=kees"/>
<to uri = "log:result"/>
</route>
</camelContext>