Search in sources :

Example 96 with RequestBody

use of com.reprezen.kaizen.oasparser.model3.RequestBody in project org.hl7.fhir.core by hapifhir.

the class Client method issuePostFeedRequest.

public Bundle issuePostFeedRequest(URI resourceUri, Map<String, String> parameters, String resourceName, Resource resource, String resourceFormat) throws IOException {
    String boundary = "----WebKitFormBoundarykbMUo6H8QaUnYtRy";
    byte[] payload = ByteUtils.encodeFormSubmission(parameters, resourceName, resource, boundary);
    RequestBody body = RequestBody.create(MediaType.parse(resourceFormat + ";charset=" + DEFAULT_CHARSET), payload);
    Request.Builder request = new Request.Builder().url(resourceUri.toURL()).post(body);
    return executeBundleRequest(request, resourceFormat, new Headers.Builder().build(), null, retryCount, timeout);
}
Also used : Request(okhttp3.Request) RequestBody(okhttp3.RequestBody)

Example 97 with RequestBody

use of com.reprezen.kaizen.oasparser.model3.RequestBody in project org.hl7.fhir.core by hapifhir.

the class Client method issuePutRequest.

public <T extends Resource> ResourceRequest<T> issuePutRequest(URI resourceUri, byte[] payload, String resourceFormat, Headers headers, String message, long timeout) throws IOException {
    if (payload == null)
        throw new EFhirClientException("PUT requests require a non-null payload");
    RequestBody body = RequestBody.create(payload);
    Request.Builder request = new Request.Builder().url(resourceUri.toURL()).put(body);
    return executeFhirRequest(request, resourceFormat, headers, message, retryCount, timeout);
}
Also used : Request(okhttp3.Request) EFhirClientException(org.hl7.fhir.r4.utils.client.EFhirClientException) RequestBody(okhttp3.RequestBody)

Example 98 with RequestBody

use of com.reprezen.kaizen.oasparser.model3.RequestBody in project google-maps-services-java by googlemaps.

the class OkHttpRequestHandler method handlePost.

@Override
public <T, R extends ApiResponse<T>> PendingResult<T> handlePost(String hostName, String url, String payload, String userAgent, String experienceIdHeaderValue, Class<R> clazz, FieldNamingPolicy fieldNamingPolicy, long errorTimeout, Integer maxRetries, ExceptionsAllowedToRetry exceptionsAllowedToRetry, RequestMetrics metrics) {
    RequestBody body = RequestBody.create(JSON, payload);
    Request.Builder builder = new Request.Builder().post(body).header("User-Agent", userAgent);
    if (experienceIdHeaderValue != null) {
        builder = builder.header(HttpHeaders.X_GOOG_MAPS_EXPERIENCE_ID, experienceIdHeaderValue);
    }
    Request req = builder.url(hostName + url).build();
    return new OkHttpPendingResult<>(req, client, clazz, fieldNamingPolicy, errorTimeout, maxRetries, exceptionsAllowedToRetry, metrics);
}
Also used : OkHttpPendingResult(com.google.maps.internal.OkHttpPendingResult) Request(okhttp3.Request) RequestBody(okhttp3.RequestBody)

Example 99 with RequestBody

use of com.reprezen.kaizen.oasparser.model3.RequestBody in project huabei_competition by fcy354268003.

the class NPCRel method queryProduct.

/**
 * 查询商店道具列表
 */
public static void queryProduct(Callback callback) {
    String json = gson.toJson(new A());
    RequestBody requestBody = RequestBody.create(ChatRoomUtil.JSON, json);
    Request request = new Request.Builder().url(LogIn.BASIC_PATH + PATH_GET_PRO_LIST).post(requestBody).build();
    client.newCall(request).enqueue(callback);
}
Also used : Request(okhttp3.Request) RequestBody(okhttp3.RequestBody)

Example 100 with RequestBody

use of com.reprezen.kaizen.oasparser.model3.RequestBody in project huabei_competition by fcy354268003.

the class NPCRel method buyProp.

/**
 * @param id 商品或者商店角色id
 */
public static void buyProp(String id, Callback callback, int type) {
    String json = gson.toJson(new Buy(id));
    RequestBody requestBody = RequestBody.create(ChatRoomUtil.JSON, json);
    Request request;
    Request.Builder builder = new Request.Builder();
    builder.url(LogIn.BASIC_PATH + PATH_BUY_PROP).post(requestBody);
    if (type == 1) {
        builder.url(LogIn.BASIC_PATH + PATH_BUY_ROLE);
    }
    request = builder.build();
    client.newCall(request).enqueue(callback);
}
Also used : Request(okhttp3.Request) 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