2012-07-02 25 views
2

我正在嘗試爲restful資源編寫一個java客戶端。我的請求的響應是對象列表。對於請求,我有以下代碼。我會得到一些unmarshall異常。任何人都可以讓我知道如何解決這個問題嗎?java restful服務客戶端接受迴應列表

GenericType<List<Response>> genType = new GenericType<List<Response>>() {}; 
GenericType<List<Response>> response = (GenericType<List<Response>>)resource.path(paramPath).accept(MediaType.APPLICATION_JSON).get(genType); 

我的資源具有下面的代碼

@GET 
@Path("/app/{Id}") 
@Produces(MediaType.APPLICATION_JSON) 
public List<Response> getAllKeyValuesByAppId(@PathParam("Id") Long Id){ 
    ... 
    ... 
} 
+0

什麼是Response類? –

+0

你可以給異常的堆棧跟蹤嗎?我假設你使用Jersey作爲REST框架,Jackson使用編組/解組? – smcg

+0

響應類是我的用戶定義的類 – user755043

回答

0

你可以測試你休息方法,無需解編? 您確定郵件正文中包含您期望的內容嗎?