2014-10-27 64 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端點。