0

I'm using Camel Rest (with restlet component) and I have the following APIs:

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()

The problem is that the /order/customer doesn't works (see Exception below). The parameters for /customer comes from JWT...

java.lang.String to the required type: java.lang.Long with value customer due Illegal characters: customer

I think that camel is confusing the ../{orderId} parameter with .../customer. If I change the /customer for /customer/orders it's works.

The same idea in Spring Boot could have done with:

@RequestMapping("/order/{orderId}")
public Order getOrder(@PathVariable Long orderId) {
    return orderRepo.findOne(orderId);
}

@RequestMapping("/order/customer")
public List<Order> getOrder() {
    return orderRepo.listOrderByCustomer(1l);
}

Any idea about what's happening?

1
  • What version of Camel do you use? Commented Mar 20, 2018 at 5:55

1 Answer 1

1

Try changing the order of your GET operations in the Camel Rest DSL. The restlet component has some issues in matching the best possible methods.

There is a couple of JIRA tickets related to this:

Sign up to request clarification or add additional context in comments.

1 Comment

Works like a charm. TKS Claus.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.