public class ServiceClientUtils extends java.lang.Object
Constructor and Description |
---|
ServiceClientUtils() |
Modifier and Type | Method and Description |
---|---|
static org.apache.http.HttpEntity |
createMultiPartEntity(java.lang.String parameterName,
java.util.List<Resource> files)
Creates a multi-part entity that uploads the given files under the given
request parameter.
|
static org.apache.http.HttpEntity |
createMultiPartEntityForFiles(java.lang.String parameterName,
java.util.List<java.io.File> files)
Creates a multi-part entity that uploads the given files under the given
request parameter.
|
static org.apache.http.client.protocol.HttpClientContext |
createPreemptiveAuthContext(org.apache.http.client.methods.HttpRequestBase request)
Creates a HTTP context for preemptive basic authentication, i.e.
|
static <T> T |
executeRequest(org.apache.http.client.HttpClient client,
org.apache.http.client.methods.HttpRequestBase request,
EMimeType contentType,
CollectionUtils.FunctionWithException<java.lang.String,T,java.io.IOException> deserializeFunction)
Executes a request and handles the response.
|
static org.apache.http.impl.client.CloseableHttpClient |
getHttpClient(ServerDetails serverDetails)
Sets up the HTTP client and returns it.
|
public ServiceClientUtils()
public static org.apache.http.impl.client.CloseableHttpClient getHttpClient(ServerDetails serverDetails) throws ServiceCallException
ServiceCallException
public static org.apache.http.client.protocol.HttpClientContext createPreemptiveAuthContext(org.apache.http.client.methods.HttpRequestBase request)
public static org.apache.http.HttpEntity createMultiPartEntity(java.lang.String parameterName, java.util.List<Resource> files)
public static org.apache.http.HttpEntity createMultiPartEntityForFiles(java.lang.String parameterName, java.util.List<java.io.File> files)
public static <T> T executeRequest(org.apache.http.client.HttpClient client, org.apache.http.client.methods.HttpRequestBase request, EMimeType contentType, CollectionUtils.FunctionWithException<java.lang.String,T,java.io.IOException> deserializeFunction) throws ServiceCallException
ServiceCallException