All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.bitmovin.network.http.JSONRestClient Maven / Gradle / Ivy
package com.bitmovin.network.http;
import java.io.IOException;
import java.net.URI;
import java.util.Map;
import com.google.gson.Gson;
public class JSONRestClient extends RestClient{
public JSONRestClient(URI baseUrl) {
super(baseUrl);
}
public T post(URI resource, Map headers, Object content, Class classOfT) throws IOException, RestException {
Gson gson = new Gson();
String jsoncontent = gson.toJson(content);
String response = this.request(RequestMethod.POST, resource, headers, jsoncontent);
return gson.fromJson(response, classOfT);
}
public T get(URI resource, Map headers, Class classOfT) throws IOException, RestException {
Gson gson = new Gson();
String response = this.request(RequestMethod.GET, resource, headers);
return gson.fromJson(response, classOfT);
}
public T delete(URI resource, Map headers, Class classOfT) throws IOException, RestException {
Gson gson = new Gson();
String response = this.request(RequestMethod.DELETE, resource, headers);
return gson.fromJson(response, classOfT);
}
public void post(URI resource, Map headers, Object content) throws IOException, RestException {
Gson gson = new Gson();
String jsoncontent = gson.toJson(content);
this.request(RequestMethod.POST, resource, headers, jsoncontent);
}
public void get(URI resource, Map headers) throws IOException, RestException {
this.request(RequestMethod.GET, resource, headers);
}
public void delete(URI resource, Map headers) throws IOException, RestException {
this.request(RequestMethod.DELETE, resource, headers);
}
}