Class RestClientService
java.lang.Object
org.eclipse.ecf.remoteservice.asyncproxy.AbstractAsyncProxyRemoteService
org.eclipse.ecf.remoteservice.AbstractRemoteService
org.eclipse.ecf.remoteservice.client.AbstractClientService
org.eclipse.ecf.remoteservice.rest.client.AbstractRestClientService
org.eclipse.ecf.remoteservice.rest.client.RestClientService
- All Implemented Interfaces:
InvocationHandler,IRemoteService
This class represents a REST service from the client side of view. So a
RESTful web service can be accessed via the methods provided by this class.
Mostly the methods are inherited from
IRemoteService.-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.ecf.remoteservice.client.AbstractClientService
AbstractClientService.AsyncResult, AbstractClientService.UriRequestNested classes/interfaces inherited from class org.eclipse.ecf.remoteservice.AbstractRemoteService
AbstractRemoteService.AsyncArgs, AbstractRemoteService.ProxyClassLoader -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intprotected static final Stringprotected static final intprotected org.apache.http.client.HttpClientprotected intstatic final intFields inherited from class org.eclipse.ecf.remoteservice.client.AbstractClientService
container, registrationFields inherited from class org.eclipse.ecf.remoteservice.AbstractRemoteService
EMPTY_ARGS, futureExecutorService, futureExecutorServiceMaxThreads, iFutureExecutor -
Constructor Summary
ConstructorsConstructorDescriptionRestClientService(RestClientContainer container, RemoteServiceClientRegistration registration) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddRequestHeaders(org.apache.http.message.AbstractHttpMessage httpMethod, IRemoteCall call, IRemoteCallable callable) protected org.apache.http.client.methods.HttpRequestBasecreateAndPrepareHttpMethod(String uri, IRemoteCall call, IRemoteCallable callable) protected org.apache.http.client.methods.HttpRequestBaseprotected org.apache.http.client.methods.HttpDeletecreateDeleteMethod(String uri) protected org.apache.http.client.methods.HttpGetcreateGetMethod(String uri) protected org.apache.http.client.HttpClientprotected org.apache.http.client.methods.HttpPatchcreatePatchMethod(String uri) protected org.apache.http.client.methods.HttpPostcreatePostMethod(String uri) protected org.apache.http.client.methods.HttpPutcreatePutMethod(String uri) protected byte[]getResponseAsBytes(org.apache.http.HttpResponse response) protected org.apache.http.client.entity.UrlEncodedFormEntitygetUrlEncodedFormEntity(List list, AbstractEntityRequestType postRequestType) protected ObjectinvokeRemoteCall(IRemoteCall call, IRemoteCallable callable) Calls the Rest service with given URL of IRestCall.protected org.apache.http.client.methods.HttpRequestBaseprepareDeleteMethod(String uri, IRemoteCall call, IRemoteCallable callable) protected org.apache.http.client.methods.HttpRequestBaseprepareGetMethod(String uri, IRemoteCall call, IRemoteCallable callable) protected voidprepareHttpMethod(org.apache.http.client.methods.HttpRequestBase httpMethod, IRemoteCall call, IRemoteCallable callable) protected org.apache.http.client.methods.HttpRequestBasepreparePatchMethod(String uri, IRemoteCall call, IRemoteCallable callable) protected org.apache.http.client.methods.HttpRequestBasepreparePostMethod(String uri, IRemoteCall call, IRemoteCallable callable) protected org.apache.http.client.methods.HttpRequestBasepreparePutMethod(String uri, IRemoteCall call, IRemoteCallable callable) protected booleanretrieveErrorResponseBody(org.apache.http.HttpResponse response) protected voidsetupAuthenticaton(org.apache.http.client.HttpClient httpClient, org.apache.http.client.methods.HttpRequestBase method) protected voidsetupHttpMethod(org.apache.http.client.methods.HttpRequestBase httpMethod, IRemoteCall call, IRemoteCallable callable) protected voidsetupTimeouts(org.apache.http.client.HttpClient httpClient, IRemoteCall call, IRemoteCallable callable) protected org.apache.http.NameValuePair[]toNameValuePairs(String uri, IRemoteCall call, IRemoteCallable callable) Methods inherited from class org.eclipse.ecf.remoteservice.rest.client.AbstractRestClientService
handleException, handleException, logException, logWarning, traceMethods inherited from class org.eclipse.ecf.remoteservice.client.AbstractClientService
callAsync, callAsync, callAsync, callAsync, callSync, createUriRequest, fireAsync, getCallMethodNameForProxyInvoke, getCallParametersForProxyInvoke, getClientContainer, getInterfaceClassNames, getNextRequestID, getRegistration, getRemoteServiceID, getRemoteServiceReference, handleInvokeException, invokeSync, prepareEndpointAddress, prepareParameters, processResponseMethods inherited from class org.eclipse.ecf.remoteservice.AbstractRemoteService
addAsyncProxyClasses, addRemoteServiceProxyToProxy, callAsync, callAsync, callAsyncWithResult, callAsyncWithTimeout, callAsyncWithTimeout, callCompletableAsync, callFutureAsync, callFutureAsync, callSync, convertInterfaceNameToAsyncInterfaceName, createProxy, createProxy, createRCCE, createRCCEFailure, createRCCESuccess, createRemoteCall, dispose, findAsyncRemoteServiceProxyClass, findAsyncRemoteServiceProxyClass, getAsyncArgs, getAsyncInvokeMethodName, getAsyncRemoteCall, getCallTimeoutForProxyInvoke, getDefaultTimeout, getFutureExecutorService, getIFutureExecutor, getProxy, getProxy, getRemoteService, getRemoteServiceProxyCreator, handleInvokeSyncException, handleProxyException, invoke, invokeAsync, invokeObject, invokeReturnAsync, isAsync, isInterfaceAsync, isMethodAsync, isOSGIAsync, loadInterfaceClass, loadInterfaceClass, setFutureExecutorService, setIFutureExecutorMethods inherited from class org.eclipse.ecf.remoteservice.asyncproxy.AbstractAsyncProxyRemoteService
callFuture, isReturnAsync
-
Field Details
-
socketTimeout
public static final int socketTimeout -
connectRequestTimeout
public static final int connectRequestTimeout -
connectTimeout
public static final int connectTimeout -
DEFAULT_RESPONSE_BUFFER_SIZE
protected static final int DEFAULT_RESPONSE_BUFFER_SIZE- See Also:
-
DEFAULT_HTTP_CONTENT_CHARSET
- See Also:
-
httpClient
protected org.apache.http.client.HttpClient httpClient -
responseBufferSize
protected int responseBufferSize
-
-
Constructor Details
-
RestClientService
public RestClientService(RestClientContainer container, RemoteServiceClientRegistration registration)
-
-
Method Details
-
createHttpClient
protected org.apache.http.client.HttpClient createHttpClient() -
createGetMethod
-
createPostMethod
-
createPutMethod
-
createDeleteMethod
-
createPatchMethod
- Since:
- 2.6
-
createAndPrepareHttpMethod
protected org.apache.http.client.methods.HttpRequestBase createAndPrepareHttpMethod(AbstractClientService.UriRequest request) -
invokeRemoteCall
Calls the Rest service with given URL of IRestCall. The returned value is the response body as an InputStream.- Specified by:
invokeRemoteCallin classAbstractClientService- Parameters:
call- The remote call to make. Must not benull.callable- The callable with default parameters to use to make the call.- Returns:
- The InputStream of the response body or
nullif an error occurs. - Throws:
ECFException- thrown if the call fails.
-
retrieveErrorResponseBody
protected boolean retrieveErrorResponseBody(org.apache.http.HttpResponse response) -
getResponseAsBytes
- Throws:
IOException
-
setupTimeouts
protected void setupTimeouts(org.apache.http.client.HttpClient httpClient, IRemoteCall call, IRemoteCallable callable) -
addRequestHeaders
protected void addRequestHeaders(org.apache.http.message.AbstractHttpMessage httpMethod, IRemoteCall call, IRemoteCallable callable) -
createAndPrepareHttpMethod
protected org.apache.http.client.methods.HttpRequestBase createAndPrepareHttpMethod(String uri, IRemoteCall call, IRemoteCallable callable) throws RestException - Throws:
RestException
-
prepareHttpMethod
protected void prepareHttpMethod(org.apache.http.client.methods.HttpRequestBase httpMethod, IRemoteCall call, IRemoteCallable callable) -
setupHttpMethod
protected void setupHttpMethod(org.apache.http.client.methods.HttpRequestBase httpMethod, IRemoteCall call, IRemoteCallable callable) -
prepareDeleteMethod
protected org.apache.http.client.methods.HttpRequestBase prepareDeleteMethod(String uri, IRemoteCall call, IRemoteCallable callable) throws RestException - Throws:
RestException
-
preparePutMethod
protected org.apache.http.client.methods.HttpRequestBase preparePutMethod(String uri, IRemoteCall call, IRemoteCallable callable) throws NotSerializableException, UnsupportedEncodingException -
preparePatchMethod
protected org.apache.http.client.methods.HttpRequestBase preparePatchMethod(String uri, IRemoteCall call, IRemoteCallable callable) throws NotSerializableException, UnsupportedEncodingException - Throws:
UnsupportedEncodingExceptionECFExceptionNotSerializableException- Since:
- 2.6
-
preparePostMethod
protected org.apache.http.client.methods.HttpRequestBase preparePostMethod(String uri, IRemoteCall call, IRemoteCallable callable) throws NotSerializableException, UnsupportedEncodingException -
prepareGetMethod
protected org.apache.http.client.methods.HttpRequestBase prepareGetMethod(String uri, IRemoteCall call, IRemoteCallable callable) throws NotSerializableException - Throws:
NotSerializableExceptionECFException
-
getUrlEncodedFormEntity
protected org.apache.http.client.entity.UrlEncodedFormEntity getUrlEncodedFormEntity(List list, AbstractEntityRequestType postRequestType) throws UnsupportedEncodingException - Throws:
UnsupportedEncodingException
-
toNameValuePairs
protected org.apache.http.NameValuePair[] toNameValuePairs(String uri, IRemoteCall call, IRemoteCallable callable) throws NotSerializableException - Throws:
NotSerializableException
-
setupAuthenticaton
protected void setupAuthenticaton(org.apache.http.client.HttpClient httpClient, org.apache.http.client.methods.HttpRequestBase method)
-