我試圖用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