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.
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. The same case happens for v2.18.4 and v2.19.0.
I doubt whether there is a change in rest endpoint path reference via 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 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
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
Jun 07, 2017 11:10:16 AM 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 - -
Under camel version v2.18.0
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
WARNING: Empty pattern variables are not allowed : 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
WARNING: Empty pattern variables are not allowed : null Jun 07, 2017 11:11:33 AM 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 - -
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
Jun 26, 2017 10:12:50 AM 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 - -
Jun 26, 2017 10:14:54 AM 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 -
Jun 26, 2017 10:18:53 AM 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 -
ref:httpSysRouteBuildRemainPath
as path instead of looking up endpoint reference. Is there any method I can do to set the value from Java side? – hk6279 Jun 27 '17 at 3:32{{xxx}}
for property placeholders: camel.apache.org/using-propertyplaceholder.html – Claus Ibsen Jun 27 '17 at 5:57<post uri="#{commonUtilService.getEpUtil().getAdminHTTPSysJsonBuildRemainPath()}" id="admin_sysHttpSysJson_receiver">
, but not work when I extract it as endpoint reference – hk6279 Jun 27 '17 at 6:53