1
我在使用robospice中的spring android。我需要放置獲取請求標題,所以我使用了exchange()方法。該代碼有沒有錯誤,但沒有任何獲取Robospice loadDataFromNetwork()不工作
public MList loadDataFromNetwork() throws Exception {
HttpHeaders headers = new HttpHeaders();
headers.add(key,keyValue);
HttpEntity entity = new HttpEntity(headers);
ResponseEntity<MList> response=getRestTemplate().exchange(url,HttpMethod.GET,entity,MList.class);
return getRestTemplate().exchange(url, HttpMethod.GET,new HttpEntity<Object> (headers),MList.class).getBody();
}
那你嘗試調試時?該方法甚至被稱爲? – Snicolas 2014-11-01 12:17:09