2013-04-18 79 views
0

我目前正在嘗試Apache駱駝(作爲路由引擎)。我瞭解Camel支持多種DSL,並且可以使用Java(Java DSL)或Spring(Spring DSL)進行配置。阿帕奇駱駝:查詢參數VS頭部參數

問題:
我有以下的Spring DSL配置。我們的想法是,如果傳入的請求具有標題,PARAM所謂的「名」,這將打擊時,從句或別的會請求路由到谷歌:

<camel:route> 
    <camel:from uri="servlet:///test" /> 
    <camel:choice> 
     <camel:when> 
      <camel:header>name</camel:header> 
      <camel:transform> 
       <camel:simple>Hello ${header.name} how are you?</camel:simple> 
      </camel:transform> 
     </camel:when> 
     <camel:otherwise> 
       <camel:to uri="http://www.google.com?bridgeEndpoint=true" /> 
     </camel:otherwise> 
    </camel:choice> 
</camel:route> 

我希望上面的配置只爲標題帕拉姆工作。然而,我注意到,這個配置是爲查詢參數的工作甚至表現在以下要求:

http://localhost:8080/<war-context>/test?name=test 

有沒有一種方法,以確保它是由只爲標題PARAMS工作?

回答

3

它很好的記錄here查詢參數被複制到servlet組件中的交換頭。

+0

如果我有這樣的東西:http:// localhost:8080//test?name = test&age = 18,該怎麼辦?我如何得到他們兩個?只有'name'參數在標題中 – Vikash 2017-07-24 11:00:47