How to add HTTPHeader to XJSONDataSource?
Tried this, but no luck, even do not know whether it is write way of implementation.
Map<String, String> headers = new LinkedHashMap<String, String>();
headers.put("Accept", "application/json");
DSRequest reque开发者_JAVA技巧st = new DSRequest();
request.setHttpHeaders(headers);
XJSONDataSource ds = new XJSONDataSource();
ds.setDataProtocol(DSProtocol.GETPARAMS);
ds.setRequestProperties(request);
ds.setDataURL("http://cross_domain");
ds.fetchData();
I am trying for cross-domain calls to JSON services, if anyone have good example or tutorial please feel free to refer. Thanks in advance for your help.
Removed headers from above code and started working seamlessly. I guess XJSONDataSource does not like headers.
精彩评论