0
試過這個,但沒有運氣,就算不知道是不是寫的實現方式。如何將HTTPHeader添加到XJSONDataSource?
Map<String, String> headers = new LinkedHashMap<String, String>();
headers.put("Accept", "application/json");
DSRequest request = new DSRequest();
request.setHttpHeaders(headers);
XJSONDataSource ds = new XJSONDataSource();
ds.setDataProtocol(DSProtocol.GETPARAMS);
ds.setRequestProperties(request);
ds.setDataURL("http://cross_domain");
ds.fetchData();
我想跨域調用JSON服務,如果有人有很好的例子或教程,請隨時參考。在此先感謝您的幫助。