public class AlfrescoHttpClient extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
ALFRESCO_API_PATH |
static String |
ALFRESCO_API_VERSION |
static String |
MIME_TYPE_JSON |
static String |
UTF_8_ENCODING |
| Constructor and Description |
|---|
AlfrescoHttpClient(String scheme,
String host) |
AlfrescoHttpClient(String scheme,
String host,
int port) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the HttpClient.
|
void |
close(org.apache.http.impl.client.CloseableHttpClient client)
Closes the HttpClient.
|
org.apache.http.HttpResponse |
execute(String userName,
String password,
org.apache.http.client.methods.HttpRequestBase request)
Execute HttpClient request without releasing the connection
|
org.apache.http.HttpResponse |
executeRequest(org.apache.http.client.methods.HttpRequestBase request)
Deprecated.
Execute HttpClient request.
|
org.apache.http.HttpResponse |
executeRequest(String userName,
String password,
org.apache.http.client.methods.HttpRequestBase request)
Execute HttpClient request.
|
org.apache.http.HttpResponse |
executeRequest(String userName,
String password,
org.json.simple.JSONObject body,
org.apache.http.client.methods.HttpEntityEnclosingRequestBase request)
Execute HttpClient POST OR PUT
|
String |
getAlfrescoUrl() |
String |
getAlfrescoVersion()
Get the alfresco version
|
String |
getAlfTicket(String username,
String password)
Generates an Alfresco Authentication Ticket based on the user name and password passed in.
|
String |
getApiUrl() |
String |
getApiVersionUrl() |
org.apache.http.client.HttpClient |
getClient() |
List<String> |
getElementsFromJsonArray(org.apache.http.HttpResponse response,
String array,
String elementFromArray)
Get the elements from a JSONArray
|
String |
getHost() |
org.apache.http.impl.client.CloseableHttpClient |
getHttpClientWithBasicAuth(String username,
String password)
Get basic http client with basic credential.
|
String |
getParameterFromJSON(org.apache.http.HttpResponse response,
String jsonObject,
String parameter)
Method to get parameters from JSON
|
String |
getParameterFromJSON(String result,
String param)
Method to get parameters from JSON
|
int |
getPort() |
String |
getScheme() |
String |
getSpecificElementFromJArray(org.apache.http.HttpResponse response,
String array,
String itemName,
String itemParameter,
String requiredElement) |
org.json.simple.JSONObject |
readStream(org.apache.http.HttpEntity entity)
Parses http response stream into a
JSONObject. |
org.apache.http.entity.StringEntity |
setMessageBody(org.json.simple.JSONObject json)
Populate HTTP message call with given content.
|
public static final String UTF_8_ENCODING
public static final String MIME_TYPE_JSON
public static String ALFRESCO_API_PATH
public static String ALFRESCO_API_VERSION
public String getApiVersionUrl()
public String getAlfTicket(String username, String password)
username - user identifierpassword - user passwordpublic String getAlfrescoVersion()
public org.apache.http.entity.StringEntity setMessageBody(org.json.simple.JSONObject json)
json - JSONObject contentStringEntity content.public org.apache.http.HttpResponse executeRequest(org.apache.http.client.methods.HttpRequestBase request)
request - to sendHttpResponse responsepublic org.apache.http.HttpResponse execute(String userName, String password, org.apache.http.client.methods.HttpRequestBase request)
userName - user namepassword - passwordrequest - to sendHttpResponse responsepublic org.apache.http.HttpResponse executeRequest(String userName, String password, org.apache.http.client.methods.HttpRequestBase request)
userName - String user namepassword - String passwordrequest - HttpRequestBase the requestHttpResponse responsepublic org.apache.http.HttpResponse executeRequest(String userName, String password, org.json.simple.JSONObject body, org.apache.http.client.methods.HttpEntityEnclosingRequestBase request)
userName - String user namepassword - String passwordbody - JSONObject body of the requestrequest - HttpEntityEnclosingRequestBase the requestHttpResponse responsepublic org.apache.http.impl.client.CloseableHttpClient getHttpClientWithBasicAuth(String username, String password)
username - String usernamepassword - String passwordCloseableHttpClient clientpublic org.json.simple.JSONObject readStream(org.apache.http.HttpEntity entity)
JSONObject.entity - Http response entityJSONObject responsepublic String getParameterFromJSON(String result, String param)
result - json messageparam - key identifierpublic String getParameterFromJSON(org.apache.http.HttpResponse response, String jsonObject, String parameter)
response - HttpResponse responsejsonObject - String json object from responseparameter - String parameter from jsonpublic List<String> getElementsFromJsonArray(org.apache.http.HttpResponse response, String array, String elementFromArray)
response - HttpResponse responsearray - String the name of the arrayelementFromArray - element from arraypublic String getSpecificElementFromJArray(org.apache.http.HttpResponse response, String array, String itemName, String itemParameter, String requiredElement)
public void close()
IOException - if errorpublic void close(org.apache.http.impl.client.CloseableHttpClient client)
client - CloseableHttpClient the clientIOException - if errorpublic org.apache.http.client.HttpClient getClient()
public String getScheme()
public String getHost()
public int getPort()
public String getApiUrl()
public String getAlfrescoUrl()
Copyright © 2016 Alfresco Software. All rights reserved.