我想知道使用是否多余 consumes
和procudes
bindingMode
?
rest()
.description("rest service provider")
.consumes("application/xml").produces("application/xml")
.post("/start").type(P.class)
.bindingMode(RestBindingMode.json_xml)
.description("Service to start a test process")
.route().routeId("REST").log("Message send: n ${body}")
我应该只使用这些行之一吗?有什么区别?
.consumes("application/xml").produces("application/xml")
.bindingMode(RestBindingMode.json_xml)
你在其余配置上使用 .bindingMode 来竞标 xml/json 与 POJO。您可以在其余 VERB 操作中使用 .consume 或 .produce 来指定要接收或生成的类型。
restConfiguration()
.component("restlet|jetty|servlet")
.host("localhost")
.port(portNum)
.bindingMode(RestBindingMode.auto);
rest("/url/")
.get("/bye").consumes("application/json")
.to("direct:bye")