问题描述
我有以下骆驼路由配置.
I have following camel routing configuration.
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<!-- Rest Configuration -->
<restConfiguration component="jetty" port="9092" bindingMode="auto">
<dataFormatProperty key="json.in.disableFeatures" value="FAIL_ON_UNKNOWN_PROPERTIES" />
</restConfiguration>
<rest path="/" consumes="application/json"
produces="application/json">
<post uri="/" type="com.aaa.xxxx.esb.config.xxxxEsbJsonMapping">
<route>
<setHeader headerName="Authorization">
<simple>Basic YWRtaXXXXWRtaW4=</simple>
</setHeader>
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<setHeader headerName="RestEndpointURL">
<simple>
http://${body.serviceURL}?bridgeEndpoint=true
</simple>
</setHeader>
<setBody>
<simple>{"UserDetails": ${body.serviceDataJsonObj}}</simple>
</setBody>
<log message="Exchanged headers : ${headers.RestEndpointURL}" />
<recipientList>
<simple>${headers.RestEndpointURL}</simple>
</recipientList>
</route>
</post>
</rest>
我需要知道的是我可以设置的地方
What I need to know is where I can set
我已经为骆驼休息配置的码头组件的
选项.
option for the jetty component which I have already configured for camel rest.
根据Claus Ibsen的回答,我如下更改了配置XML.
According to the Claus Ibsen answer, I changed configuration XML as follows.
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<!-- Rest Configuration -->
<restConfiguration component="jetty" port="9092"
bindingMode="auto">
<dataFormatProperty key="json.in.disableFeatures"
value="FAIL_ON_UNKNOWN_PROPERTIES" />
<componentProperty key="matchOnUriPrefix" value="true" />
</restConfiguration>
<!-- Rest Services -->
<rest path="/" consumes="application/json" produces="application/json">
<post uri="/" type="com.aaa.xxxx.esb.config.xxxxEsbJsonMapping">
<route>
<setHeader headerName="Authorization">
<simple>Basic YWRXXX46YWRtaW4=</simple>
</setHeader>
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<setHeader headerName="RestEndpointURL">
<simple>
http://${body.serviceURL}?bridgeEndpoint=true
</simple>
</setHeader>
<setBody>
<simple>{"SystemUserDetails": ${body.serviceDataJsonObj}}</simple>
</setBody>
<log message="Exchanged headers : ${headers.RestEndpointURL}" />
<recipientList>
<simple>${headers.RestEndpointURL}</simple>
</recipientList>
</route>
</post>
</rest>
</camelContext>
我正在使用servicemix apache-servicemix-7.0.0.M2我将其骆驼版本2.16.3升级到2.17.3
I'm using servicemix apache-servicemix-7.0.0.M2I upgraded its camel ver 2.16.3 to 2.17.3
谢谢
推荐答案
rest-dsl使用restConfiguration
中的componentProperty
配置:
The rest-dsl is configured using the componentProperty
in the restConfiguration
:
<restConfiguration component="jetty" port="9092" bindingMode="auto">
<componentProperty key="matchOnUriPrefix" value="true"/>
<dataFormatProperty key="json.in.disableFeatures" value="FAIL_ON_UNKNOWN_PROPERTIES" />
</restConfiguration>
您可以在文档中找到有关此内容的详细信息: http://camel.apache.org/rest- dsl
You can find details about this in the documentation: http://camel.apache.org/rest-dsl
这篇关于骆驼:如何为在< restConfiguration>中配置的码头组件设置matchOnUriPrefix = true的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!