apache camel bean to servlet - 交换机体缺失

时间:2016-08-26 11:41:33

标签: servlets apache-camel cxf

我正在使用带有弹簧和弹簧的apl驼鹿。尝试根据header参数从cxfrs bean路由到servlet。下面是驼峰路线配置

<camelContext xmlns="http://camel.apache.org/schema/spring">

        <route>
            <from uri="cxfrs://bean://service?bindingStyle=SimpleConsumer" />
            <to uri="log:body?level=INFO" />
            <camel:filter>
                <camel:simple>${in.header.export} == true</camel:simple>
                <setProperty propertyName="exchange">
                <camel:spel>#{exchange}</camel:spel>
                </setProperty>
                <camel:to uri="http://localhost:8080/service/Reports?exchange=${property.exchange}&amp;bridgeEndpoint=true"/>
            </camel:filter>
            <to uri="bean:businessDelegate" />
        </route>

问题是来自服务的JSON有效负载没有被转移到http servlet。下面是web xml

    <servlet>
        <display-name>ReportServlet</display-name>
        <servlet-name>ReportServlet</servlet-name>
        <servlet-class>
            org.springframework.web.context.support.HttpRequestHandlerServlet
        </servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>ReportServlet</servlet-name>
        <url-pattern>/Reports/*</url-pattern>
    </servlet-mapping>          
  <servlet>
    <servlet-name>CXFServlet</servlet-name>
    <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>CXFServlet</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>

请帮助。如何将交换体从初始请求转移到Servlet? servlet的http请求标头和参数为空。

1 个答案:

答案 0 :(得分:0)

可能是由于记录了导致空体的消息体。请参阅此常见问题解答:http://camel.apache.org/why-is-my-message-body-empty.html