Apache camel 驼峰REST(restlet)URL-与路径参数混淆
我正在使用Camel-Rest(带有restlet组件),我有以下API:Apache camel 驼峰REST(restlet)URL-与路径参数混淆,apache-camel,Apache Camel,我正在使用Camel-Rest(带有restlet组件),我有以下API: rest("/order") .get("/{orderId}").produces("application/json") .param().dataType("int").type(RestParamType.path).name("orderId").endParam() .route() .bean(OrderService.class, "findOrderById")
rest("/order")
.get("/{orderId}").produces("application/json")
.param().dataType("int").type(RestParamType.path).name("orderId").endParam()
.route()
.bean(OrderService.class, "findOrderById")
.endRest()
.get("/customer").produces("application/json").route()
.bean(OrderService.class, "findOrderByCustomerId")
.endRest()
问题是/order/customer不起作用(参见下面的异常)。/customer的参数来自JWT
将java.lang.String设置为所需的类型:java.lang.Long,带值
客户到期非法字符:客户
我认为camel将../{orderId}参数与../customer混淆了。
如果我更改/customer for/customer/orders,它将正常工作
Spring Boot中的相同想法可以通过以下方式实现:
@RequestMapping("/order/{orderId}")
public Order getOrder(@PathVariable Long orderId) {
return orderRepo.findOne(orderId);
}
@RequestMapping("/order/customer")
public List<Order> getOrder() {
return orderRepo.listOrderByCustomer(1l);
}
@RequestMapping(“/order/{orderId}”)
公共订单getOrder(@PathVariable Long orderId){
返回orderRepo.findOne(orderId);
}
@请求映射(“/order/customer”)
公共列表getOrder(){
退货订单repo.listOrderByCustomer(1l);
}
知道发生了什么吗?尝试更改Camel Rest DSL中GET操作的顺序。restlet组件在匹配最佳方法方面存在一些问题 有几张JIRA门票与此相关: