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
 
 public class RestClientService extends AbstractRestClientService 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 fromIRemoteService.
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class org.eclipse.ecf.remoteservice.client.AbstractClientServiceAbstractClientService.AsyncResult, AbstractClientService.UriRequest
 - 
Nested classes/interfaces inherited from class org.eclipse.ecf.remoteservice.AbstractRemoteServiceAbstractRemoteService.AsyncArgs, AbstractRemoteService.ProxyClassLoader
 
- 
 - 
Field SummaryFields Modifier and Type Field Description static intconnectRequestTimeoutstatic intconnectTimeoutprotected static StringDEFAULT_HTTP_CONTENT_CHARSETprotected static intDEFAULT_RESPONSE_BUFFER_SIZEprotected org.apache.http.client.HttpClienthttpClientprotected intresponseBufferSizestatic intsocketTimeout- 
Fields inherited from class org.eclipse.ecf.remoteservice.client.AbstractClientServicecontainer, registration
 - 
Fields inherited from class org.eclipse.ecf.remoteservice.AbstractRemoteServiceEMPTY_ARGS, futureExecutorService, futureExecutorServiceMaxThreads, iFutureExecutor
 
- 
 - 
Constructor SummaryConstructors Constructor Description RestClientService(RestClientContainer container, RemoteServiceClientRegistration registration)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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.HttpRequestBasecreateAndPrepareHttpMethod(AbstractClientService.UriRequest request)protected org.apache.http.client.methods.HttpDeletecreateDeleteMethod(String uri)protected org.apache.http.client.methods.HttpGetcreateGetMethod(String uri)protected org.apache.http.client.HttpClientcreateHttpClient()protected 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.AbstractRestClientServicehandleException, handleException, logException, logWarning, trace
 - 
Methods inherited from class org.eclipse.ecf.remoteservice.client.AbstractClientServicecallAsync, callAsync, callAsync, callAsync, callSync, createUriRequest, fireAsync, getCallMethodNameForProxyInvoke, getCallParametersForProxyInvoke, getClientContainer, getInterfaceClassNames, getNextRequestID, getRegistration, getRemoteServiceID, getRemoteServiceReference, handleInvokeException, invokeSync, prepareEndpointAddress, prepareParameters, processResponse
 - 
Methods inherited from class org.eclipse.ecf.remoteservice.AbstractRemoteServiceaddAsyncProxyClasses, 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, setIFutureExecutor
 - 
Methods inherited from class org.eclipse.ecf.remoteservice.asyncproxy.AbstractAsyncProxyRemoteServicecallFuture, isReturnAsync
 
- 
 
- 
- 
- 
Field Detail- 
socketTimeoutpublic static final int socketTimeout 
 - 
connectRequestTimeoutpublic static final int connectRequestTimeout 
 - 
connectTimeoutpublic static final int connectTimeout 
 - 
DEFAULT_RESPONSE_BUFFER_SIZEprotected static final int DEFAULT_RESPONSE_BUFFER_SIZE - See Also:
- Constant Field Values
 
 - 
DEFAULT_HTTP_CONTENT_CHARSETprotected static final String DEFAULT_HTTP_CONTENT_CHARSET - See Also:
- Constant Field Values
 
 - 
httpClientprotected org.apache.http.client.HttpClient httpClient 
 - 
responseBufferSizeprotected int responseBufferSize 
 
- 
 - 
Constructor Detail- 
RestClientServicepublic RestClientService(RestClientContainer container, RemoteServiceClientRegistration registration) 
 
- 
 - 
Method Detail- 
createHttpClientprotected org.apache.http.client.HttpClient createHttpClient() 
 - 
createGetMethodprotected org.apache.http.client.methods.HttpGet createGetMethod(String uri) 
 - 
createPostMethodprotected org.apache.http.client.methods.HttpPost createPostMethod(String uri) 
 - 
createPutMethodprotected org.apache.http.client.methods.HttpPut createPutMethod(String uri) 
 - 
createDeleteMethodprotected org.apache.http.client.methods.HttpDelete createDeleteMethod(String uri) 
 - 
createPatchMethodprotected org.apache.http.client.methods.HttpPatch createPatchMethod(String uri) - Since:
- 2.6
 
 - 
createAndPrepareHttpMethodprotected org.apache.http.client.methods.HttpRequestBase createAndPrepareHttpMethod(AbstractClientService.UriRequest request) 
 - 
invokeRemoteCallprotected Object invokeRemoteCall(IRemoteCall call, IRemoteCallable callable) throws ECFException Calls the Rest service with given URL of IRestCall. The returned value is the response body as an InputStream.- Specified by:
- invokeRemoteCallin class- AbstractClientService
- Parameters:
- call- The remote call to make. Must not be- null.
- 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.
 
 - 
retrieveErrorResponseBodyprotected boolean retrieveErrorResponseBody(org.apache.http.HttpResponse response) 
 - 
getResponseAsBytesprotected byte[] getResponseAsBytes(org.apache.http.HttpResponse response) throws IOException- Throws:
- IOException
 
 - 
setupTimeoutsprotected void setupTimeouts(org.apache.http.client.HttpClient httpClient, IRemoteCall call, IRemoteCallable callable)
 - 
addRequestHeadersprotected void addRequestHeaders(org.apache.http.message.AbstractHttpMessage httpMethod, IRemoteCall call, IRemoteCallable callable)
 - 
createAndPrepareHttpMethodprotected org.apache.http.client.methods.HttpRequestBase createAndPrepareHttpMethod(String uri, IRemoteCall call, IRemoteCallable callable) throws RestException - Throws:
- RestException
 
 - 
prepareHttpMethodprotected void prepareHttpMethod(org.apache.http.client.methods.HttpRequestBase httpMethod, IRemoteCall call, IRemoteCallable callable)
 - 
setupHttpMethodprotected void setupHttpMethod(org.apache.http.client.methods.HttpRequestBase httpMethod, IRemoteCall call, IRemoteCallable callable)
 - 
prepareDeleteMethodprotected org.apache.http.client.methods.HttpRequestBase prepareDeleteMethod(String uri, IRemoteCall call, IRemoteCallable callable) throws RestException - Throws:
- RestException
 
 - 
preparePutMethodprotected org.apache.http.client.methods.HttpRequestBase preparePutMethod(String uri, IRemoteCall call, IRemoteCallable callable) throws NotSerializableException, UnsupportedEncodingException 
 - 
preparePatchMethodprotected org.apache.http.client.methods.HttpRequestBase preparePatchMethod(String uri, IRemoteCall call, IRemoteCallable callable) throws NotSerializableException, UnsupportedEncodingException - Throws:
- UnsupportedEncodingException
- ECFException
- NotSerializableException
- Since:
- 2.6
 
 - 
preparePostMethodprotected org.apache.http.client.methods.HttpRequestBase preparePostMethod(String uri, IRemoteCall call, IRemoteCallable callable) throws NotSerializableException, UnsupportedEncodingException 
 - 
prepareGetMethodprotected org.apache.http.client.methods.HttpRequestBase prepareGetMethod(String uri, IRemoteCall call, IRemoteCallable callable) throws NotSerializableException - Throws:
- NotSerializableException
- ECFException
 
 - 
getUrlEncodedFormEntityprotected org.apache.http.client.entity.UrlEncodedFormEntity getUrlEncodedFormEntity(List list, AbstractEntityRequestType postRequestType) throws UnsupportedEncodingException - Throws:
- UnsupportedEncodingException
 
 - 
toNameValuePairsprotected org.apache.http.NameValuePair[] toNameValuePairs(String uri, IRemoteCall call, IRemoteCallable callable) throws NotSerializableException - Throws:
- NotSerializableException
 
 - 
setupAuthenticatonprotected void setupAuthenticaton(org.apache.http.client.HttpClient httpClient, org.apache.http.client.methods.HttpRequestBase method)
 
- 
 
-