Esempio n. 1
0
 private static void request(
     XMLHttpRequest xhr, String method, String url, final XhrCallback callback) {
   try {
     xhr.setOnReadyStateChange(new Handler(callback));
     xhr.open(method, url);
     xhr.send();
   } catch (Exception e) {
     // Just fail.
     callback.onFail(xhr);
     xhr.clearOnReadyStateChange();
   }
 }
Esempio n. 2
0
 private static void request(
     XMLHttpRequest xhr,
     String method,
     String url,
     String requestData,
     String contentType,
     XhrCallback callback) {
   try {
     xhr.setOnReadyStateChange(new Handler(callback));
     xhr.open(method, url);
     xhr.setRequestHeader("Content-type", contentType);
     xhr.send(requestData);
   } catch (Exception e) {
     // Just fail.
     callback.onFail(xhr);
     xhr.clearOnReadyStateChange();
   }
 }