0
我需要從HttpResponse中讀取一個List(或一般對象),但是我得到一個沒有消息的異常。通過HTTP從服務器獲取對象的最佳方式是什麼?
通過http從服務器獲取對象的最佳方式是什麼?
我的實現不工作:
List projectList = new ArrayList();
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(url+"&action=getProjectList");
HttpResponse response = client.execute(request);
Object obj = null;
InputStream inputStream = response.getEntity().getContent();
// This is where the exception occurs
ObjectInputStream responseObject = new ObjectInputStream(inputStream);
if ((obj = responseObject.readObject()) != null)
{
projectList = (List) obj;
}
謝謝,這似乎解決了這個問題,但我現在將它打開,以防萬一我有問題;-) – mw88