All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.client.rest.impl.okhttp.StringRestEntityOkHttp Maven / Gradle / Ivy

There is a newer version: 14.0.33.Final
Show newest version
package org.infinispan.client.rest.impl.okhttp;

import org.infinispan.client.rest.RestEntity;
import org.infinispan.commons.dataconversion.MediaType;

import okhttp3.RequestBody;

/**
 * @author Tristan Tarrant <[email protected]>
 * @since 10.0
 **/
public class StringRestEntityOkHttp implements RestEntity, RestEntityAdaptorOkHttp {
   private final MediaType contentType;
   private final String body;

   public StringRestEntityOkHttp(MediaType contentType, String body) {
      this.contentType = contentType;
      this.body = body;
   }

   @Override
   public String getBody() {
      return body;
   }

   @Override
   public MediaType contentType() {
      return contentType;
   }

   @Override
   public RequestBody toRequestBody() {
      return RequestBody.create(okhttp3.MediaType.get(contentType.toString()), body);
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy