public class ApacheHttpClient extends AbstractHttpClient
| Modifier and Type | Field and Description |
|---|---|
ConcurrentHashMap<UUID,InstanceInfo> |
instances |
ConcurrentHashMap<String,MATLABRequestInfo.MATLAB_Request_Info> |
pendingNotifications |
ConcurrentHashMap<UUID,MWRequestImpl> |
pendingRequests |
ConcurrentHashMap<String,ConcurrentHashMap<String,MWRequestImpl>> |
requestsCreated |
closed, CONTENT_TYPE| Constructor and Description |
|---|
ApacheHttpClient(MWHttpClientConfig clientConfig,
MWSSLConfig sslConfig,
MWHttpClient mwClient) |
| Modifier and Type | Method and Description |
|---|---|
URI |
buildGetResultUri(String serverUri,
String requestUrl) |
URI |
buildGetUpdatesSinceUri(InstanceInfo instance) |
void |
close()
Closes the client-server communication
|
void |
executeDelete(String deleteUrl,
org.apache.http.client.protocol.HttpClientContext context)
Initiates HTTP DELETE request
|
void |
executeGet(org.apache.http.client.methods.HttpGet getReq,
org.apache.http.client.protocol.HttpClientContext context,
org.apache.http.concurrent.FutureCallback<org.apache.http.HttpResponse> callback)
Initiates an asynchronous HTTP GET request with a callback attached
|
void |
executeGetForNotifications(InstanceInfo currentInstance)
Issues a polling thread for getting notifications
|
Future<org.apache.http.HttpResponse> |
executeGetSync(URI uri,
org.apache.http.client.protocol.HttpClientContext context)
Initiates asynchronous HTTP GET request and returns the future object to
perform a blocking get on.
|
<T> void |
executePost(org.apache.http.client.methods.HttpPost postReq,
MATLABParams.MATLAB_Params mlParams,
org.apache.http.client.protocol.HttpClientContext context,
HttpResponseCallback<T> callback)
Initiates asynchronous HTTP POST request with a callback attached
|
<T> void |
executePostCancel(org.apache.http.client.methods.HttpPost postReq,
MATLABParams.MATLAB_Params mlParams,
org.apache.http.client.protocol.HttpClientContext context,
HttpResponseCallback<T> callback) |
MWClientUsageLock |
getClientUsageLock() |
org.apache.http.nio.client.HttpAsyncClient |
getHttpClientAsync() |
MWHttpClient |
getMWClient() |
int |
getResponseSizeLimit() |
HTTPErrorInfo.HTTP_Error_Info |
parseHttpErrorInfo(org.apache.http.HttpResponse response)
Parses the HTTPResponse and returns the HTTP_Error_Info
|
MATLABRequestCreated.MATLAB_Request_Created |
parseMATLABRequest(org.apache.http.HttpResponse response)
Parses the HTTPResponse and returns the MATLAB_Request.
|
MATLABResult.MATLAB_Result |
parseMATLABResult(org.apache.http.HttpResponse response)
Parses the HTTPResponse and returns the MATLAB_Result.
|
MATLABRequestNotification.MATLAB_Request_Notification |
parseRequestNotification(org.apache.http.HttpResponse response)
Parses the HTTPResponse and returns the MATLAB_Request_Notification
|
<T> void |
registerRequest(MWRequestImpl<T> request,
UUID uuid,
String serverUri,
String mps_session_id,
org.apache.http.client.protocol.HttpClientContext context)
Register the new request in the Requests map and start a polling thread
if one does not exist already.
|
void |
setClientUsageLock(MWClientUsageLock clientUsageLock) |
<T> void |
updateRequest(String requestUrl,
MATLABRequestInfo.MATLAB_Request_Info serverRequestInfo,
String mpsSessionId)
Update the MWRequest object and notify the listener about the state
change.
|
isClosed, isSecureConnectionpublic ConcurrentHashMap<UUID,InstanceInfo> instances
public ConcurrentHashMap<String,ConcurrentHashMap<String,MWRequestImpl>> requestsCreated
public ConcurrentHashMap<String,MATLABRequestInfo.MATLAB_Request_Info> pendingNotifications
public ConcurrentHashMap<UUID,MWRequestImpl> pendingRequests
public ApacheHttpClient(MWHttpClientConfig clientConfig, MWSSLConfig sslConfig, MWHttpClient mwClient)
public org.apache.http.nio.client.HttpAsyncClient getHttpClientAsync()
public int getResponseSizeLimit()
public MWHttpClient getMWClient()
public MWClientUsageLock getClientUsageLock()
public void setClientUsageLock(MWClientUsageLock clientUsageLock)
public <T> void executePost(org.apache.http.client.methods.HttpPost postReq,
MATLABParams.MATLAB_Params mlParams,
org.apache.http.client.protocol.HttpClientContext context,
HttpResponseCallback<T> callback)
postReq - mlParams - context - callback - public <T> void executePostCancel(org.apache.http.client.methods.HttpPost postReq,
MATLABParams.MATLAB_Params mlParams,
org.apache.http.client.protocol.HttpClientContext context,
HttpResponseCallback<T> callback)
public void executeGet(org.apache.http.client.methods.HttpGet getReq,
org.apache.http.client.protocol.HttpClientContext context,
org.apache.http.concurrent.FutureCallback<org.apache.http.HttpResponse> callback)
getReq - context - callback - URISyntaxExceptionpublic Future<org.apache.http.HttpResponse> executeGetSync(URI uri, org.apache.http.client.protocol.HttpClientContext context) throws URISyntaxException
uri - URISyntaxExceptionpublic void executeDelete(String deleteUrl, org.apache.http.client.protocol.HttpClientContext context)
deleteUrl - context - public void executeGetForNotifications(InstanceInfo currentInstance) throws URISyntaxException
currentInstance - URISyntaxExceptionpublic <T> void updateRequest(String requestUrl, MATLABRequestInfo.MATLAB_Request_Info serverRequestInfo, String mpsSessionId)
requestUrl - serverRequestInfo - public <T> void registerRequest(MWRequestImpl<T> request, UUID uuid, String serverUri, String mps_session_id, org.apache.http.client.protocol.HttpClientContext context) throws URISyntaxException
request - uuid - serverUri - URISyntaxExceptionpublic URI buildGetResultUri(String serverUri, String requestUrl) throws URISyntaxException
URISyntaxExceptionpublic URI buildGetUpdatesSinceUri(InstanceInfo instance) throws URISyntaxException
URISyntaxExceptionpublic MATLABResult.MATLAB_Result parseMATLABResult(org.apache.http.HttpResponse response) throws IOException
response - IOExceptionpublic MATLABRequestCreated.MATLAB_Request_Created parseMATLABRequest(org.apache.http.HttpResponse response) throws IOException
response - IOExceptionpublic MATLABRequestNotification.MATLAB_Request_Notification parseRequestNotification(org.apache.http.HttpResponse response) throws IOException
response - IOExceptionpublic HTTPErrorInfo.HTTP_Error_Info parseHttpErrorInfo(org.apache.http.HttpResponse response) throws IOException
response - IOExceptionpublic void close()
AbstractHttpClientclose in class AbstractHttpClientCopyright © 2015–2024. All rights reserved.