Simplification and generalization of UriRequest.
Change-Id: I2fd6c6c84489d0b86d91c674fba86fb069d33de9
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rest/src/org/eclipse/ecf/remoteservice/rest/client/RestClientService.java b/framework/bundles/org.eclipse.ecf.remoteservice.rest/src/org/eclipse/ecf/remoteservice/rest/client/RestClientService.java
index bc216a8..282e29d 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice.rest/src/org/eclipse/ecf/remoteservice/rest/client/RestClientService.java
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.rest/src/org/eclipse/ecf/remoteservice/rest/client/RestClientService.java
@@ -81,10 +81,11 @@
return new HttpDelete(uri);
}
- protected HttpRequestBase createAndPrepareHttpMethod(UriRequest request, IRemoteCall call, IRemoteCallable callable) {
+ protected HttpRequestBase createAndPrepareHttpMethod(UriRequest request) {
HttpRequestBase httpMethod = null;
String uri = request.getUri();
- IRemoteCallableRequestType requestType = request.getRequestType();
+ final IRemoteCallable callable = request.getRemoteCallable();
+ IRemoteCallableRequestType requestType = (callable == null) ? new HttpGetRequestType() : callable.getRequestType();
if (requestType instanceof HttpGetRequestType)
httpMethod = createGetMethod(uri);
else if (requestType instanceof HttpPostRequestType)
@@ -94,7 +95,7 @@
else if (requestType instanceof HttpDeleteRequestType)
httpMethod = createDeleteMethod(uri);
// all prepare HttpMethod
- prepareHttpMethod(httpMethod, call, callable);
+ prepareHttpMethod(httpMethod, request.getRemoteCall(), callable);
return httpMethod;
}
@@ -113,9 +114,9 @@
trace("invokeRemoteCall", "call=" + call + ";callable=" + callable); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
String endpointUri = prepareEndpointAddress(call, callable);
trace("invokeRemoteCall", "prepared endpoint=" + endpointUri); //$NON-NLS-1$ //$NON-NLS-2$
- UriRequest request = createUriRequest(endpointUri, call, callable);
+ UriRequest urirequest = createUriRequest(endpointUri, call, callable);
// If the request
- HttpRequestBase httpMethod = (request == null) ? createAndPrepareHttpMethod(endpointUri, call, callable) : createAndPrepareHttpMethod(request, call, callable);
+ HttpRequestBase httpMethod = (urirequest == null) ? createAndPrepareHttpMethod(endpointUri, call, callable) : createAndPrepareHttpMethod(urirequest);
trace("invokeRemoteCall", "executing httpMethod" + httpMethod); //$NON-NLS-1$ //$NON-NLS-2$
// execute method
byte[] responseBody = null;
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/client/AbstractClientService.java b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/client/AbstractClientService.java
index 7e75004..8ae6718 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/client/AbstractClientService.java
+++ b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/client/AbstractClientService.java
@@ -226,19 +226,25 @@
*/
public static class UriRequest {
private final String uri;
- private final IRemoteCallableRequestType requestType;
+ private final IRemoteCall call;
+ private final IRemoteCallable callable;
- public UriRequest(String uri, IRemoteCallableRequestType requestType) {
+ public UriRequest(String uri, IRemoteCall call, IRemoteCallable callable) {
this.uri = uri;
- this.requestType = requestType;
+ this.call = call;
+ this.callable = callable;
}
public String getUri() {
return uri;
}
- public IRemoteCallableRequestType getRequestType() {
- return requestType;
+ public IRemoteCall getRemoteCall() {
+ return call;
+ }
+
+ public IRemoteCallable getRemoteCallable() {
+ return callable;
}
}