public void postBatchObject(List<Object> parameters, boolean sync, Map<String, String> header, GenericObjectCallback callback) { try { String url = batchUrl(); Map<String, Object> requests = batchRequest(parameters); String json = JSON.toJSONString(requests); if (AVOSCloud.isDebugLogEnabled()) { dumpHttpPostRequest(header, url, json); } AsyncHttpResponseHandler handler = createPostHandler(callback); AVHttpClient client = AVHttpClient.clientInstance(); Request.Builder builder = new Request.Builder(); builder.url(url).post(RequestBody.create(AVHttpClient.JSON, json)); updateHeaders(builder, header, callback != null && callback.isRequestStatisticNeed()); client.execute(builder.build(), sync, handler); } catch (Exception exception) { processException(exception, callback); } }
public void postObject(final String relativePath, String object, final Map<String, String> headers, boolean sync, boolean isEventually, GenericObjectCallback callback, String objectId, String _internalId) { try { if (isEventually) { File archivedFile = archiveRequest("post", relativePath, object, objectId, _internalId); handleArchivedRequest(archivedFile, sync, callback); } else { String url = buildUrl(relativePath); if (AVOSCloud.isDebugLogEnabled()) { dumpHttpPostRequest(null, url, object); } AsyncHttpResponseHandler handler = createPostHandler(callback); AVHttpClient client = AVHttpClient.clientInstance(); Request.Builder builder = new Request.Builder(); updateHeaders(builder, headers, callback != null && callback.isRequestStatisticNeed()); builder.url(url).post(RequestBody.create(AVHttpClient.JSON, object)); client.execute(builder.build(), sync, handler); } } catch (Exception exception) { processException(exception, callback); } }
public void postBatchSave(final List list, final boolean sync, final boolean isEventually, final Map<String, String> header, final GenericObjectCallback callback, final String objectId, final String _internalId) { try { Map params = new HashMap(); params.put("requests", list); String paramString = AVUtils.jsonStringFromMapWithNull(params); if (isEventually) { File archivedFile = archiveRequest("post", batchSaveRelativeUrl(), paramString, objectId, _internalId); handleArchivedRequest(archivedFile, sync, callback); } else { String url = buildUrl(batchSaveRelativeUrl()); if (AVOSCloud.isDebugLogEnabled()) { dumpHttpPostRequest(header, url, paramString); } AsyncHttpResponseHandler handler = createPostHandler(callback); AVHttpClient client = AVHttpClient.clientInstance(); Request.Builder builder = new Request.Builder(); builder.url(url).post(RequestBody.create(AVHttpClient.JSON, paramString)); updateHeaders(builder, header, callback != null && callback.isRequestStatisticNeed()); client.execute(builder.build(), sync, handler); } } catch (Exception exception) { processException(exception, callback); } }
public void postBatchObject(List<Object> parameters, boolean sync, Map<String, String> header, GenericObjectCallback callback) { try { String url = batchUrl(); Map<String, Object> requests = batchRequest(parameters); String json = JSON.toJSONString(requests); if (InternalConfigurationController.globalInstance().getInternalLogger().isDebugEnabled()) { dumpHttpPostRequest(header, url, json); } AsyncHttpResponseHandler handler = createPostHandler(callback); AVHttpClient client = clientInstance(); Request.Builder builder = new Request.Builder(); builder.url(url).post(RequestBody.create(AVHttpClient.JSON, json)); updateHeaders(builder, header, callback != null && callback.isRequestStatisticNeed()); client.execute(builder.build(), sync, handler); } catch (Exception exception) { processException(exception, callback); } }
public void postBatchSave(final List list, final boolean sync, final boolean isEventually, final Map<String, String> header, final GenericObjectCallback callback, final String objectId, final String _internalId) { try { Map params = new HashMap(); params.put("requests", list); String paramString = AVUtils.jsonStringFromMapWithNull(params); if (isEventually) { File archivedFile = archiveRequest("post", batchSaveRelativeUrl(), paramString, objectId, _internalId); handleArchivedRequest(archivedFile, sync, callback); } else { String url = buildUrl(batchSaveRelativeUrl()); if (InternalConfigurationController.globalInstance().getInternalLogger().isDebugEnabled()) { dumpHttpPostRequest(header, url, paramString); } AsyncHttpResponseHandler handler = createPostHandler(callback); AVHttpClient client = clientInstance(); Request.Builder builder = new Request.Builder(); updateHeaders(builder, header, callback != null && callback.isRequestStatisticNeed()); builder.url(url).post(RequestBody.create(AVHttpClient.JSON, paramString)); client.execute(builder.build(), sync, handler); } } catch (Exception exception) { processException(exception, callback); } }
public void postObject(final String relativePath, String object, boolean sync, boolean isEventually, GenericObjectCallback callback, String objectId, String _internalId) { try { if (isEventually) { File archivedFile = archiveRequest("post", relativePath, object, objectId, _internalId); handleArchivedRequest(archivedFile, sync, callback); } else { String url = buildUrl(relativePath); if (InternalConfigurationController.globalInstance().getInternalLogger().isDebugEnabled()) { dumpHttpPostRequest(null, url, object); } AsyncHttpResponseHandler handler = createPostHandler(callback); AVHttpClient client = clientInstance(); Request.Builder builder = new Request.Builder(); updateHeaders(builder, null, callback != null && callback.isRequestStatisticNeed()); builder.url(url).post(RequestBody.create(AVHttpClient.JSON, object)); client.execute(builder.build(), sync, handler); } } catch (Exception exception) { processException(exception, callback); } }