使用生产和消费设置绑定模式是否多余



我想知道使用是否多余 consumesprocudes 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")

最新更新