public class RestClient extends Object
Modifier and Type | Field and Description |
---|---|
static String |
ACCEPT_TYPE_APPLICATION_JSON |
static String |
CHARSET_UTF_8 |
static String |
CONTENT_TYPE_APPLICATION_JSON |
static String |
ESL_ACCEPT_TYPE_APPLICATION_JSON |
static String |
ESL_API_VERSION |
static String |
ESL_API_VERSION_HEADER |
static String |
ESL_CONTENT_TYPE_APPLICATION_JSON |
static String |
HEADER_KEY_ACCEPT |
Constructor and Description |
---|
RestClient(String apiToken) |
Modifier and Type | Method and Description |
---|---|
protected void |
addAuthorizationHeader(org.apache.http.client.methods.HttpUriRequest request) |
String |
delete(String path) |
String |
get(String path) |
String |
get(String path,
String acceptType) |
byte[] |
getBytes(String path) |
String |
post(String path,
String jsonPayload) |
void |
postMultipartFile(String path,
String fileName,
byte[] fileBytes,
String jsonPayload) |
String |
postMultipartPackage(String path,
Collection<Document> documents,
String jsonPayload) |
String |
put(String path,
String jsonPayload) |
public static final String CHARSET_UTF_8
public static final String ESL_API_VERSION
public static final String ESL_API_VERSION_HEADER
public static final String CONTENT_TYPE_APPLICATION_JSON
public static final String ESL_CONTENT_TYPE_APPLICATION_JSON
public static final String HEADER_KEY_ACCEPT
public static final String ACCEPT_TYPE_APPLICATION_JSON
public static final String ESL_ACCEPT_TYPE_APPLICATION_JSON
public RestClient(String apiToken)
public String post(String path, String jsonPayload) throws IOException, org.apache.http.HttpException, URISyntaxException, RequestException
IOException
org.apache.http.HttpException
URISyntaxException
RequestException
public String put(String path, String jsonPayload) throws IOException, RequestException
IOException
RequestException
public void postMultipartFile(String path, String fileName, byte[] fileBytes, String jsonPayload) throws IOException, org.apache.http.HttpException, URISyntaxException, RequestException
IOException
org.apache.http.HttpException
URISyntaxException
RequestException
public String postMultipartPackage(String path, Collection<Document> documents, String jsonPayload) throws IOException, org.apache.http.HttpException, URISyntaxException, RequestException
IOException
org.apache.http.HttpException
URISyntaxException
RequestException
protected void addAuthorizationHeader(org.apache.http.client.methods.HttpUriRequest request)
public String get(String path) throws IOException, org.apache.http.HttpException, URISyntaxException, RequestException
IOException
org.apache.http.HttpException
URISyntaxException
RequestException
public String get(String path, String acceptType) throws IOException, org.apache.http.HttpException, URISyntaxException, RequestException
IOException
org.apache.http.HttpException
URISyntaxException
RequestException
public byte[] getBytes(String path) throws IOException, org.apache.http.HttpException, URISyntaxException, RequestException
IOException
org.apache.http.HttpException
URISyntaxException
RequestException
public String delete(String path) throws org.apache.http.HttpException, IOException, URISyntaxException, RequestException
org.apache.http.HttpException
IOException
URISyntaxException
RequestException
Copyright 2014, Silanis Technology, Inc. All rights reserved.