use of com.google.gwt.http.client.RequestBuilder in project gerrit by GerritCodeReview.
the class RestApi method sendJSON.
private <T extends JavaScriptObject> void sendJSON(Method method, JavaScriptObject content, HttpCallback<T> cb) {
HttpImpl<T> httpCallback = new HttpImpl<>(background, cb);
try {
if (!background) {
RpcStatus.INSTANCE.onRpcStart();
}
RequestBuilder req = request(method);
req.setHeader("Content-Type", JSON_UTF8);
req.sendRequest(str(content), httpCallback);
} catch (RequestException e) {
httpCallback.onError(null, e);
}
}
Aggregations