使用Apache骆驼中的netty4组件执行发布

时间:2019-01-18 16:20:11

标签: apache-camel netty

我想在骆驼中使用netty4进行发布,但返回错误请求400,我尝试了许多http选项的排列,以查看是否有任何工作但结果相同(作为消费者,其工作,但作为生产者,工作不一样)< / p>

@Component 公共类RestDslRouteBuilder扩展RouteBuilder {

@Override
public void configure() throws Exception {

    restConfiguration()
    .component("netty4-http")
    .host("localhost").port("8686")
    .enableCORS(true)
    .corsHeaderProperty("Access-Control-Allow-Origin", "*")
    .corsHeaderProperty("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS")
   .bindingMode(RestBindingMode.json);

    rest("/api")
    .get("/")
        .to("bean:helloBean")
    .post().type(PostRequestType.class)
        .to("bean:postBean");

    /*from("netty4-http:http://localhost:8686/foo")
  .transform().constant("Bye World");
  */

from("netty4-http:http://localhost:8686/foo")
  .log("Logged id issue without body: ${header.id}")
 .to("netty4-http:http://ptsv2.com/t/8wl8p-1547734804/post?bridgeEndpoint=true");


}

0 个答案:

没有答案