我有一个使用骆驼休息组件的应用程序。本来,我使用骆驼版本v2.17.0和每个休息端点返回时返回代码200呼叫时。Apache Camel - Spring Rest端点引用
有一天,当我更新我的应用程序的骆驼版本到v2.18.0(没有任何其他更改)时,所有其余的端点在调用时返回http返回码404。 v2.18.4和v2.19.0发生同样的情况。
我怀疑是否有一个通过Spring休息端点路径引用的变化。有谁知道如何纠正我的设置?我正在使用的解决方法是将硬编码字符串移回Spring,这不符合我的意图。
弹簧设置为REST服务
<endpoint id="httpAppRouteBuildRemainPath" uri="#{commonUtilService.getEpUtil().getHTTPAppJsonBuildRemainPath()}" />
<endpoint id="httpSysRouteBuildRemainPath" uri="#{commonUtilService.getEpUtil().getHTTPSysJsonBuildRemainPath()}" />
<endpoint id="httpJsonBuildManagementRouteEndPoint" uri="#{commonUtilService.getEpUtil().getHTTPJsonBuildManagementRouteEndpointPath()}" />
<rest path="#commonUtilService.getEpUtil().getHTTPJsonManagementRestPath()">
<put uri="ref:httpAppRouteBuildRemainPath" id="appHttpRouteReceiver">
<to uri="ref:httpJsonBuildManagementRouteEndPoint"/>
</put>
<put uri="ref:httpSysRouteBuildRemainPath" id="sysHttpRouteReceiver">
<to uri="ref:httpJsonBuildManagementRouteEndPoint"/>
</put>
</rest>
的Java安装
public String getHTTPJsonManagementRestPath() {
return "/worker/json";
}
public String getHTTPAppJsonBuildRemainPath() {
return "/app/build";
}
public String getHTTPSysJsonBuildRemainPath() {
return "/sys/build";
}
测试结果
在骆驼版本v2.17.0
2017年6月7日上午11点10分十六秒org.restlet.engine.log.LogFilter afterHandle
INFO:2017年6月7日11点10分16秒0:0:0:0:0: 0:0:1 - - 9395 PUT /工人/ JSON /应用程序/生成 - - -
在骆驼版本v2.18.0
2017年6月7日11:11:33 AM org.restlet.routing.Template getRegexPattern
警告:空模式变量是不允许的:空 2017年6月7日上午11时11分33秒org.restlet.routing.Template getRegexPattern
警告:空模式变量是不允许的:空 07年6月,2017年上午11点11分33秒org.restlet.routing.Template getRegexPattern
警告:空模式变量是不允许的:空 2017年6月7日上午11点11分33秒org.restlet.routing.Template getRegexPattern
警告:不允许使用空模式变量:null Jun 07,2017 11:11:33 AM org.restlet.engine.log。LogFilter afterHandle
INFO:2017年6月7日十一点11分33秒0:0:0:0:0:0:0:1 - - 9395 PUT /工人/ JSON /应用程序/生成 - - -
更新
我改变弹簧设置到
<rest path="/worker/json">
<put uri="/app/build" id="appHttpRouteReceiver">
<to uri="ref:httpJsonBuildManagementRouteEndPoint"/>
</put>
<put uri="ref:httpSysRouteBuildRemainPath" id="sysHttpRouteReceiver">
<to uri="ref:httpJsonBuildManagementRouteEndPoint"/>
</put>
</rest>
测试结果
在骆驼版本v2.18.0
2017年6月26日上午10时十二分50秒org.restlet.engine.log.LogFilter afterHandle
信息:2017- 06-26 10时12分五十秒0:0:0:0:0:0:0:1 - - 9395 PUT /工人/ JSON/REF:httpSysRouteBuildRemainPath - - -
2017年6月26日上午10:14:54 org.restlet.engine.log.LogFilter afterHandle
信息:2017-06-26 10:14:54 0:0:0:0:0:0: 0:1 - - 9395 PUT /工人/ JSON/应用程序/构建 - Jakarta通用-的HttpClient/3.1 -
2017年6月26日上午10时18分53秒org.restlet。 engine.log.LogFilter afterHandle
INFO:2017-06-26 10:18:53 0:0:0:0:0:0:0:1 - - 9395 PUT/worker/json/sys/build - 的Jakarta Commons-的HttpClient/3.1 -
你有2个把它最终会以相同的路径,你应该使用不同的路径或只有1把 –
@ClausIbsen看起来像其余端点使用'ref:httpSysRouteBuildRemainPath'作为路径而不是查找端点引用。有什么方法可以从Java端设置值吗? – hk6279
使用属性占位符的{{xxx}}:http://camel.apache.org/using-propertyplaceholder.html –