org.eclipse.ecf.remoteservice.rest.client
Class RestClientService
java.lang.Object
org.eclipse.ecf.remoteservice.AbstractRemoteService
org.eclipse.ecf.remoteservice.client.AbstractClientService
org.eclipse.ecf.remoteservice.rest.client.RestClientService
- All Implemented Interfaces:
- java.lang.reflect.InvocationHandler, IRemoteService
public class RestClientService
- extends AbstractClientService
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
.
Method Summary |
protected void |
addRequestHeaders(org.apache.commons.httpclient.HttpMethod httpMethod,
IRemoteCall call,
IRemoteCallable callable)
|
protected org.apache.commons.httpclient.HttpMethod |
createAndPrepareHttpMethod(java.lang.String uri,
IRemoteCall call,
IRemoteCallable callable)
|
protected java.lang.String |
getResponseAsString(byte[] bytes,
java.lang.String responseCharSet)
|
protected void |
handleException(java.lang.String message,
java.lang.Throwable e,
int responseCode)
|
protected java.lang.Object |
invokeRemoteCall(IRemoteCall call,
IRemoteCallable callable)
Calls the Rest service with given URL of IRestCall. |
protected void |
logException(java.lang.String string,
java.lang.Throwable e)
|
protected void |
logWarning(java.lang.String string,
java.lang.Throwable e)
|
protected org.apache.commons.httpclient.HttpMethod |
prepareDeleteMethod(java.lang.String uri,
IRemoteCall call,
IRemoteCallable callable)
|
protected org.apache.commons.httpclient.HttpMethod |
prepareGetMethod(java.lang.String uri,
IRemoteCall call,
IRemoteCallable callable)
|
protected org.apache.commons.httpclient.HttpMethod |
preparePostMethod(java.lang.String uri,
IRemoteCall call,
IRemoteCallable callable)
|
protected org.apache.commons.httpclient.HttpMethod |
preparePutMethod(java.lang.String uri,
IRemoteCall call,
IRemoteCallable callable)
|
protected void |
setupAuthenticaton(org.apache.commons.httpclient.HttpClient httpClient,
org.apache.commons.httpclient.HttpMethod method)
|
protected void |
setupTimeouts(org.apache.commons.httpclient.HttpClient httpClient,
IRemoteCall call,
IRemoteCallable callable)
|
protected org.apache.commons.httpclient.NameValuePair[] |
toNameValuePairs(java.lang.String uri,
IRemoteCall call,
IRemoteCallable callable)
|
Methods inherited from class org.eclipse.ecf.remoteservice.client.AbstractClientService |
callAsync, callAsync, callAsync, callAsync, callSync, fireAsync, getCallMethodNameForProxyInvoke, getCallParametersForProxyInvoke, getClientContainer, getInterfaceClassNames, getNextRequestID, getRegistration, getRemoteServiceID, getRemoteServiceReference, handleInvokeException, invokeSync, prepareEndpointAddress, prepareParameters, processResponse |
Methods inherited from class org.eclipse.ecf.remoteservice.AbstractRemoteService |
convertInterfaceNameToAsyncInterfaceName, createProxy, findAsyncRemoteServiceProxyClass, getAsyncArgs, getAsyncInvokeMethodName, getCallTimeoutForProxyInvoke, getDefaultTimeout, getProxy, getRemoteService, invoke, invokeAsync, invokeObject, loadInterfaceClass |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_RESPONSE_BUFFER_SIZE
protected static final int DEFAULT_RESPONSE_BUFFER_SIZE
- See Also:
- Constant Field Values
DEFAULT_HTTP_CONTENT_CHARSET
protected static final java.lang.String DEFAULT_HTTP_CONTENT_CHARSET
- See Also:
- Constant Field Values
httpClient
protected org.apache.commons.httpclient.HttpClient httpClient
responseBufferSize
protected int responseBufferSize
RestClientService
public RestClientService(RestClientContainer container,
RemoteServiceClientRegistration registration)
invokeRemoteCall
protected java.lang.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:
invokeRemoteCall
in 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
null
if an
error occurs.
- Throws:
ECFException
- thrown if the call fails.
getResponseAsString
protected java.lang.String getResponseAsString(byte[] bytes,
java.lang.String responseCharSet)
handleException
protected void handleException(java.lang.String message,
java.lang.Throwable e,
int responseCode)
throws RestException
- Throws:
RestException
setupTimeouts
protected void setupTimeouts(org.apache.commons.httpclient.HttpClient httpClient,
IRemoteCall call,
IRemoteCallable callable)
addRequestHeaders
protected void addRequestHeaders(org.apache.commons.httpclient.HttpMethod httpMethod,
IRemoteCall call,
IRemoteCallable callable)
createAndPrepareHttpMethod
protected org.apache.commons.httpclient.HttpMethod createAndPrepareHttpMethod(java.lang.String uri,
IRemoteCall call,
IRemoteCallable callable)
throws RestException
- Throws:
RestException
prepareDeleteMethod
protected org.apache.commons.httpclient.HttpMethod prepareDeleteMethod(java.lang.String uri,
IRemoteCall call,
IRemoteCallable callable)
throws RestException
- Throws:
RestException
preparePutMethod
protected org.apache.commons.httpclient.HttpMethod preparePutMethod(java.lang.String uri,
IRemoteCall call,
IRemoteCallable callable)
throws java.io.NotSerializableException
- Throws:
java.io.NotSerializableException
preparePostMethod
protected org.apache.commons.httpclient.HttpMethod preparePostMethod(java.lang.String uri,
IRemoteCall call,
IRemoteCallable callable)
throws java.io.NotSerializableException
- Throws:
ECFException
java.io.NotSerializableException
prepareGetMethod
protected org.apache.commons.httpclient.HttpMethod prepareGetMethod(java.lang.String uri,
IRemoteCall call,
IRemoteCallable callable)
throws java.io.NotSerializableException
- Throws:
ECFException
java.io.NotSerializableException
toNameValuePairs
protected org.apache.commons.httpclient.NameValuePair[] toNameValuePairs(java.lang.String uri,
IRemoteCall call,
IRemoteCallable callable)
throws java.io.NotSerializableException
- Throws:
java.io.NotSerializableException
setupAuthenticaton
protected void setupAuthenticaton(org.apache.commons.httpclient.HttpClient httpClient,
org.apache.commons.httpclient.HttpMethod method)
logException
protected void logException(java.lang.String string,
java.lang.Throwable e)
logWarning
protected void logWarning(java.lang.String string,
java.lang.Throwable e)
- Overrides:
logWarning
in class AbstractRemoteService