[英]Apache Camel - Spring rest endpoint reference
I have an application using camel rest component. 我有一个使用骆驼休息组件的应用程序。 Originally, I use camel version v2.17.0 and every rest endpoint returns http return code 200 when call.
最初,我使用骆驼版本v2.17.0,并且每个其余端点在调用时都返回http返回码200。
One day when I update my application's camel version to v2.18.0 (without any other change), all rest endpoint returns http return code 404 when call. 有一天,当我将应用程序的骆驼版本更新为v2.18.0(无任何其他更改)时,所有其余端点在调用时均返回http返回码404。 The same case happens for v2.18.4 and v2.19.0.
v2.18.4和v2.19.0也会发生相同的情况。
I doubt whether there is a change in rest endpoint path reference via Spring. 我怀疑通过Spring的其余端点路径引用是否有变化。 Is anyone know how to correct my setup?
有人知道如何更正我的设置吗? The workaround I am using is to move hardcode String back to Spring which does not fit my intention.
我正在使用的解决方法是将硬代码字符串移回Spring,这不符合我的意图。
Spring setup for Rest Service 春季设置休息服务
<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 Setup Java设置
public String getHTTPJsonManagementRestPath() {
return "/worker/json";
}
public String getHTTPAppJsonBuildRemainPath() {
return "/app/build";
}
public String getHTTPSysJsonBuildRemainPath() {
return "/sys/build";
}
Test Result 测试结果
Under camel version v2.17.0 在骆驼版本v2.17.0下
Jun 07, 2017 11:10:16 AM org.restlet.engine.log.LogFilter afterHandle
2017年6月7日11:10:16 org.restlet.engine.log.LogFilter afterHandle
INFO: 2017-06-07 11:10:16 0:0:0:0:0:0:0:1 - - 9395 PUT /worker/json/app/build - 200 40 124 35 http://localhost:9395 - -
信息:2017-06-07 11:10:16 0:0:0:0:0:0:0:1--9395 PUT / worker / json / app / build- 200 40 124 35 http:// localhost: 9395--
Under camel version v2.18.0 在骆驼版本v2.18.0下
Jun 07, 2017 11:11:33 AM org.restlet.routing.Template getRegexPattern
2017年6月7日11:11:33 org.restlet.routing.Template getRegexPattern
WARNING: Empty pattern variables are not allowed : null Jun 07, 2017 11:11:33 AM org.restlet.routing.Template getRegexPattern
警告:不允许使用空模式变量:null Jun 07,2017 11:11:33 AM org.restlet.routing.Template getRegexPattern
WARNING: Empty pattern variables are not allowed : null Jun 07, 2017 11:11:33 AM org.restlet.routing.Template getRegexPattern
警告:不允许使用空模式变量:null Jun 07,2017 11:11:33 AM org.restlet.routing.Template getRegexPattern
WARNING: Empty pattern variables are not allowed : null Jun 07, 2017 11:11:33 AM org.restlet.routing.Template getRegexPattern
警告:不允许使用空模式变量:null Jun 07,2017 11:11:33 AM org.restlet.routing.Template getRegexPattern
WARNING: Empty pattern variables are not allowed : null Jun 07, 2017 11:11:33 AM org.restlet.engine.log.LogFilter afterHandle
警告:不允许使用空模式变量:null 2017年6月7日上午11:11:33 org.restlet.engine.log.LogFilter afterHandle
INFO: 2017-06-07 11:11:33 0:0:0:0:0:0:0:1 - - 9395 PUT /worker/json/app/build - 404 439 124 12 http://localhost:9395 - -
INFO:2017年6月7日11点十一分33秒0:0:0:0:0:0:0:1 - - 9395 PUT /工人/ JSON /应用程序/生成- 404 439 124 12 的http://本地主机: 9395--
Update 更新资料
I change the spring setup to 我将弹簧设置更改为
<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>
Test result 测试结果
Under camel version v2.18.0 在骆驼版本v2.18.0下
Jun 26, 2017 10:12:50 AM org.restlet.engine.log.LogFilter afterHandle
2017年6月26日10:12:50 org.restlet.engine.log.LogFilter afterHandle
INFO: 2017-06-26 10:12:50 0:0:0:0:0:0:0:1 - - 9395 PUT /worker/json/ ref:httpSysRouteBuildRemainPath - 200 61 46 39 http://localhost:9395 - -
信息:2017-06-26 10:12:50 0:0:0:0:0:0:0:1--9395 PUT / worker / json / ref:httpSysRouteBuildRemainPath - 200 61 46 39 http:// localhost: 9395--
Jun 26, 2017 10:14:54 AM org.restlet.engine.log.LogFilter afterHandle
2017年6月26日10:14:54 org.restlet.engine.log.LogFilter afterHandle
INFO: 2017-06-26 10:14:54 0:0:0:0:0:0:0:1 - - 9395 PUT /worker/json/ app/build - 200 61 40 18 http://localhost:9395 Jakarta Commons-HttpClient/3.1 -
信息:2017-06-26 10:14:54 0:0:0:0:0:0:0:1--9395 PUT / worker / json / app / build - 200 61 40 18 http:// localhost: 9395 Jakarta Commons-HttpClient / 3.1-
Jun 26, 2017 10:18:53 AM org.restlet.engine.log.LogFilter afterHandle
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 - 404 439 40 6 http://localhost:9395 Jakarta Commons-HttpClient/3.1 -
INFO:2017年6月26日10时18分53秒0:0:0:0:0:0:0:1 - - 9395 PUT /工人/ JSON / SYS /建立 - 404 439 40 6 的http://本地主机: 9395 Jakarta Commons-HttpClient / 3.1-
我记录了一张票以调查此事: https : //issues.apache.org/jira/browse/CAMEL-11414
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.