2014-09-04 40 views
1

檢索字符串列表我有一個API的這樣從分散路徑

http://host/api/categories 

在我的數據庫類別基本URL是基於樹模型。我希望能有一個API,我可以打網址像

http://host/api/categories/delivery 

http://host/api/categories/delivery/food 

http://host/api/categories/delivery/medicine 

我怎樣才能詞「類別」作爲一個字符串後拉的一切(和分裂它自己)或列表字符串?從第三個例子中獲取List(「delivery」,「medicine」)基本上是很好的。

回答

2

超級簡單的答案只是使用

pathPrefix("listJobCategories"/Segments) { query => 

和查詢將列表[字符串]