in platform-http/src/main/java/org/apache/camel/example/springboot/CamelRouter.java [34:73]
public void configure() throws Exception {
restConfiguration()
.bindingMode(RestBindingMode.json);
// @formatter:off
rest("/todos").description("Todo REST service")
.consumes("application/json")
.produces("application/json")
.get().description("Find all todos").outType(Todo[].class)
.responseMessage().code(200).message("All todos successfully returned").endResponseMessage()
.to("bean:todoService?method=listAll")
.get("/{id}").description("Find todo by ID")
.outType(Todo.class)
.param().name("id").type(path).description("The ID of the todo").dataType("long").endParam()
.responseMessage().code(200).message("Todo successfully returned").endResponseMessage()
.to("bean:todoService?method=findById(${header.id})")
.patch("/{id}").description("Update a todo").type(Todo.class)
.param().name("id").type(path).description("The ID of the todo to update").dataType("long").endParam()
.param().name("body").type(body).description("The todo to update").endParam()
.responseMessage().code(204).message("Todo successfully updated").endResponseMessage()
.to("bean:todoService?method=update(${body}, ${header.id})")
.post().description("Create a todo").type(Todo.class)
.param().name("body").type(body).endParam()
.responseMessage().code(201).message("Todo successfully created").endResponseMessage()
.to("bean:todoService?method=create")
.delete().description("Delete completed todos")
.responseMessage().code(200).message("Todos deleted").endResponseMessage()
.to("bean:todoService?method=deleteCompleted")
.delete("/{id}").description("Delete by id")
.param().name("id").type(path).description("The ID of the todo to delete").dataType("long").endParam()
.responseMessage().code(200).message("Todo deleted").endResponseMessage()
.to("bean:todoService?method=deleteOne(${header.id})");
// @formatter:on
}