JBoss.orgCommunity Documentation

Use JavaScript

Creating an URL to make a request (consists of repository name, the method name, for example "/children/", and folderID to get children from):



 var url = "http://localhost:8080/rest/private/cmisatom/";
 url += repository;
 url += "/children/";
 url += obj_id;

Performing request:



 var params = {};
 params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.GET;
 params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.FEED;
 gadgets.io.makeRequest(url, handler, params);

Processing results (the code is located in the handler is specified while making a request, the same way it might be used for all examples in this chapter):



var handler = function(resp) {
  var data = eval(resp.data.Entry);
   for (var i = 0; i < data.length; i++) {
     var doc = data[i];
     alert(doc.Title);  
     alert(doc.Date);  
      ...etc..
   }
}