6.4. camel-rest
通过 其余 组件,您可以使用 Rest DSL 和插件到其他 Camel 组件作为 REST 传输来定义 REST 端点。
注意
EAP 子系统上的 Camel 只支持 camel-servlet 和 camel-undertow 组件以用于 REST DSL。但是,如果尝试配置其他组件,则子系统不起作用。
CamelContext camelctx = new DefaultCamelContext();
camelctx.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
restConfiguration().component("servlet").contextPath("camel/rest").port(8080);
rest("/hello").get("/{name}").to("direct:hello");
from("direct:hello").transform(simple("Hello ${header.name}"));
}
});