在Apache Camel中的rest客户端上测试发出REST请求时没有响应

时间:2017-05-08 11:19:33

标签: apache-camel

在Apache Camel中的rest客户端上测试REST请求时没有响应 我是新手并且使用Apache Camel和RESTful服务。当我用url提出请求时,我正在

CamelHttpTransportServlet - 无服务请求的消费者org.apache.catalina.connector.RequestFacade 这是我的web.xml的一些内容

<servlet>
    <display-name>Camel Http Transport Servlet</display-name>
    <servlet-name>myServlet</servlet-name>
    <servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class>
    <load-on-startup>0</load-on-startup>
    <init-param>
    <param-name>ignoreDuplicateServletName</param-name>
    <param-value>true</param-value>
  </init-param>
  </servlet>
  <servlet-mapping>
    <servlet-name>myServlet</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping> 

这是我的RouteBuilder的代码

public void configure() throws Exception {
    restConfiguration().component("servlet").contextPath("/my").bindingMode(RestBindingMode.off).endpointProperty("servletName", "myServlet");

        rest("/card").post("/load")
            .type(CardActRequest.class)
            .to("direct:load");

         onException(Exception.class)
        .handled(true)
        .bean(CardRequestResponse, "createErrorResponse");

         from("direct:load")
         .process(CardRequestResponse)
         .bean(CardRequestResponse, "processRequest") 
            .choice()
                .when(simple("${body} != null"))
                    .to("stream:out")
                    .bean(CardRequestResponse, "processResponse").endChoice()
                .otherwise()
                    .bean(CardRequestResponse, "createErrorResponse");

    }

现在,当我按以下顺序发出请求时: http://localhost:8080/my/card/load

0 个答案:

没有答案