2016-11-14 85 views
1

我有一個休息的服務,工作的「.route」文件,它在URI中間的資源:駱駝路由配置文件與查詢參數

<from uri='restlet:/foo/{id}/bar 

這只是正常的,我能夠檢索在代碼中使用「身份證」:

String id = e.getIn().getHeader("id", String.class); 

現在,我希望有一個「.route」與URI與它的查詢參數。 我嘗試了一堆的方式,如:

<from uri='restlet:/foo/baz?color={aColor} 

但是,這並不工作,我得到一個404錯誤,服務器無法找到URI。 這似乎是一個非常簡單/一般的事情,任何人都知道如何做到這一點? 我查看了文檔,但我無法弄清楚如何去做。

回答

0

所有參數在問號收到後作爲駱駝選項(例如restletMethod,connectionTimeout ....請參閱http://camel.apache.org/restlet.html)。只需在您的路線中使用<from uri='restlet:/foo/{id}/bar,將查詢中的參數傳遞爲http://localhost:8080/mywebapp/rs/foo/1234/bar?color=red並獲取它String id = e.getIn().getHeader("color", String.class);