示例#1
0
文件: Ajax.java 项目: hoota/strictweb
  void throwError(String shortMsg, Throwable th, VoidDelegate<Throwable> errorHandler) {
    if (th == null) th = new JsException(shortMsg);

    if (errorHandler != null) {
      errorHandler.voidDelegate(th);
    } else {
      onError(th);
    }
  }
示例#2
0
文件: Ajax.java 项目: hoota/strictweb
  public Object call(
      String clazz,
      final String method,
      Object[] args,
      final VoidDelegate<Object> callBack,
      final VoidDelegate<Throwable> errorHandler)
      throws Throwable {
    if (errorHandler != null) errorHandler.voidDelegate(null);
    else onError(null);

    boolean async = callBack != null;
    if (!async || autoRequest) {
      List<AjaxRequest> requests = StrictWeb.jsNewList();
      requests.add(new AjaxRequest(clazz, method, args, callBack, errorHandler));
      return makeRequest(async, requests, errorHandler);
    } else {
      requestQueue.add(new AjaxRequest(clazz, method, args, callBack, errorHandler));
      return null;
    }
  }