我有一個REST服務。 GET方法的輸入類型是List<String>
:列表<String>作爲GET方法的輸入
@GET
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public List<myObject> getData(List<String> IDs) {
....
}
我試圖測試使用捲曲此方法。我用了很多不同的數據組合的:
curl -X GET --data-binary '{"IDs":["TestString1","TestString2"]}' -H "Content-Type: application/json" http://localhost:8080/myModule/rs/getData -v
'{"TestString1","TestString2"}'
'["TestString1","TestString2"]'
so on
但我總是得到迴應:
Can not deserialize instance of java.util.ArrayList out of START_OBJECT token
or
Can not deserialize instance of java.util.ArrayList out of VALUE_STRING token
是否有可能有輸入作爲List<String>
?我的捲曲請求是否有誤?
沒有,嫋嫋不希望工作。 ( - 謝謝 - 你幫我找到了bug –
@VictorMezrin它是空的,因爲你正在發一個POST請求,所以方法期望GET,所以Jersey忽略了POST數據。 –