2014-10-27 28 views
0

我从移除“Host”和“org.apache.cxf.request.uri”标头时遇到问题在消息中骆驼交换。我正在使用cxfrs客户端来调用休息终点。但在调用之前,我使用removeHeaders标记并从交换中删除了一些不必要的标题。一些标题被删除。但我无法删除“主机”和“org.apache.cxf.request.uri”标题。它们在removeHeaders调用后暂时从流中移除。但是在使用cxf rs客户端调用时,它们出现在请求调用头中。以下是我的场景中的示例。从骆驼交换中删除“Host”和“org.apache.cxf.request.uri”标头

............................... .............. ................ $ {} property.asd真正== & & $ {} property.afd真正==

     **<to uri="direct:removeUnnecessaryHeaders" />** 

         <setHeader headerName="CamelCxfRsUsingHttpAPI"> 
          <constant>true</constant> 
         </setHeader> 

         <setHeader headerName="CamelHttpMethod"> 
          <constant>PUT</constant> 
         </setHeader> 

         <setHeader headerName="CamelHttpPath"> 
          <constant>/partner/managepartnerprofile</constant> 
         </setHeader> 

         <to uri="cxfrs:bean:aclient"/> 
        </when> 

.... .............................. ................... ..............

**<route> 
      <from uri="direct:removeUnnecessaryHeaders" /> 
      <removeHeaders pattern="CamelCxfRsResponseGenericType|org.apache.cxf.request.uri|CamelCxfMessage|CamelHttpResponseCode|Host" /> 
     </route>** 

回答

0

我刚做了一些测试,发现ou假设这些头文件告诉CXF如何使用WebClient构建请求,并且不应将它们视为HTTP协议头。

如果您不想将这些标头发送到服务器,则可以使用camel-http或camel-http4端点。