我试图用Apache Camel创建REST端点。我已经有一个返回JSON内容的REST服务,我希望这个端点能够得到它。我的问题是,当我的骆驼路线建成时,我不知道发生了什么。目前,它什么也没有做。这里是我的代码:REST EndPoint for Apache Camel
restConfiguration().component("servlet")
.bindingMode(RestBindingMode.json)
.dataFormatProperty("prettyPrint", "true").host("localhost")
.port(9080);
rest("/ContextServices/rest/contextServices/document")
.consumes("application/json").produces("application/json")
.get("/testContext/557064c8f7f71f29cea0e657").outTypeList(String.class)
.to("bean:processor?method=affiche")
.to(dest.getRouteTo());
我在端口9080
运行我的REST服务上的本地Tomcat的,我的完整URL是
/ContextServices/REST/contextServices /文件/ {}集合/ {ID}。
我试图读取文档,但在两个语法和都不起作用:
from("rest:get:hello:/french/{me}").transform().simple("Bonjour ${header.me}");
或
rest("/say")
.get("/hello").to("direct:hello")
.get("/bye").consumes("application/json").to("direct:bye")
.post("/bye").to("mock:update");
首先是Java的DSL,第二个是REST DSL有什么区别?
非常感谢!
您是否有任何支持REST的组件?例如camel-servlet – Sergey
嗨,如果这是你的问题,我已经将骆驼servlet加入了pom –
只对pom?你也必须在web.xml中设置servlet(检查camel.apache.org/servlet.html) – Sergey