Search in sources :

Example 71 with RequestBody

use of com.reprezen.kaizen.oasparser.model3.RequestBody in project C3 by Hi5App.

the class HttpUtilsCheckArbor method getArborUrl.

public static void getArborUrl(String arborName, int xc, int yc, int zc, String imageId, String url, Callback callback) {
    try {
        RequestBody body = RequestBody.create(JSON, String.valueOf(new JSONObject().put("arborName", arborName).put("xc", xc).put("yc", yc).put("zc", zc).put("imageId", imageId).put("url", url)));
        asyncPostRequest(GET_CHECK_INFOS_URL, body, callback);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : JSONObject(org.json.JSONObject) RequestBody(okhttp3.RequestBody)

Example 72 with RequestBody

use of com.reprezen.kaizen.oasparser.model3.RequestBody in project C3 by Hi5App.

the class HttpUtilsImage method getBrainListWithOkHttp.

public static void getBrainListWithOkHttp(JSONObject userInfo, Callback callback) {
    try {
        // set for query parameters on server, default value: off=0, limit=2000
        JSONObject queryCondition = new JSONObject().put("off", 0).put("limit", 2000);
        RequestBody body = RequestBody.create(JSON, String.valueOf(new JSONObject().put("user", userInfo).put("condition", queryCondition)));
        asyncPostRequest(URL_GET_BRAIN_LIST, body, callback);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : JSONObject(org.json.JSONObject) RequestBody(okhttp3.RequestBody)

Example 73 with RequestBody

use of com.reprezen.kaizen.oasparser.model3.RequestBody in project C3 by Hi5App.

the class HttpUtilsImage method downloadImageWithOkHttp.

/**
 * download image block
 * @param userInfo username & password
 * @param bBox info of Bounding Box, include startPos, endPos, resolution, brainId
 * @param callback the callback func
 */
public static void downloadImageWithOkHttp(JSONObject userInfo, JSONObject bBox, Callback callback) {
    try {
        RequestBody body = RequestBody.create(JSON, String.valueOf(new JSONObject().put("bb", bBox).put("user", userInfo)));
        asyncPostRequest(URL_DOWNLOAD_IMAGE, body, callback);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : JSONObject(org.json.JSONObject) RequestBody(okhttp3.RequestBody)

Example 74 with RequestBody

use of com.reprezen.kaizen.oasparser.model3.RequestBody in project C3 by Hi5App.

the class HttpUtilsImage method getNeuronListWithOkHttp.

public static void getNeuronListWithOkHttp(String username, String password, String brain_id, Callback callback) {
    try {
        RequestBody body = RequestBody.create(JSON, String.valueOf(new JSONObject().put("name", username).put("password", password).put("brain_id", brain_id)));
        asyncPostRequest(URL_GET_NEURON_LIST, body, callback);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : JSONObject(org.json.JSONObject) RequestBody(okhttp3.RequestBody)

Example 75 with RequestBody

use of com.reprezen.kaizen.oasparser.model3.RequestBody in project C3 by Hi5App.

the class HttpUtilsImage method getAnoListWithOkHttp.

public static void getAnoListWithOkHttp(String username, String password, String neuron_id, Callback callback) {
    try {
        RequestBody body = RequestBody.create(JSON, String.valueOf(new JSONObject().put("name", username).put("password", password).put("neuron_id", neuron_id)));
        asyncPostRequest(URL_GET_ANO_LIST, body, callback);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : JSONObject(org.json.JSONObject) RequestBody(okhttp3.RequestBody)

Aggregations

RequestBody (okhttp3.RequestBody)1358 Request (okhttp3.Request)785 Response (okhttp3.Response)598 IOException (java.io.IOException)420 Test (org.junit.Test)235 OkHttpClient (okhttp3.OkHttpClient)216 MultipartBody (okhttp3.MultipartBody)213 MediaType (okhttp3.MediaType)204 Call (okhttp3.Call)198 JSONObject (org.json.JSONObject)183 ResponseBody (okhttp3.ResponseBody)177 Callback (okhttp3.Callback)115 FormBody (okhttp3.FormBody)106 Buffer (okio.Buffer)98 File (java.io.File)92 Map (java.util.Map)90 JsonObject (io.vertx.core.json.JsonObject)89 Headers (okhttp3.Headers)88 HashMap (java.util.HashMap)83 HttpUrl (okhttp3.HttpUrl)80