From 6fb313dd2092d4858f5ff3ba742f9a485e0ced8d Mon Sep 17 00:00:00 2001 From: slewis Date: Wed, 17 Dec 2014 14:13:30 -0800 Subject: Improved newly added RestClientService protected methods. Change-Id: If3f023a1a3d3ac87f8329b70e1349b176c55d4e8 --- .../ecf/remoteservice/rest/client/RestClientService.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) 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 2351bb52a..bc216a885 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,11 +81,7 @@ public class RestClientService extends AbstractRestClientService { return new HttpDelete(uri); } - protected HttpRequestBase prepareHttpMethod(HttpRequestBase httpMethod) { - return httpMethod; - } - - protected HttpRequestBase createAndPrepareHttpMethod(UriRequest request) { + protected HttpRequestBase createAndPrepareHttpMethod(UriRequest request, IRemoteCall call, IRemoteCallable callable) { HttpRequestBase httpMethod = null; String uri = request.getUri(); IRemoteCallableRequestType requestType = request.getRequestType(); @@ -97,7 +93,9 @@ public class RestClientService extends AbstractRestClientService { httpMethod = createPutMethod(uri); else if (requestType instanceof HttpDeleteRequestType) httpMethod = createDeleteMethod(uri); - return prepareHttpMethod(httpMethod); + // all prepare HttpMethod + prepareHttpMethod(httpMethod, call, callable); + return httpMethod; } /** @@ -116,7 +114,8 @@ public class RestClientService extends AbstractRestClientService { String endpointUri = prepareEndpointAddress(call, callable); trace("invokeRemoteCall", "prepared endpoint=" + endpointUri); //$NON-NLS-1$ //$NON-NLS-2$ UriRequest request = createUriRequest(endpointUri, call, callable); - HttpRequestBase httpMethod = (request == null) ? createAndPrepareHttpMethod(endpointUri, call, callable) : createAndPrepareHttpMethod(request); + // If the request + HttpRequestBase httpMethod = (request == null) ? createAndPrepareHttpMethod(endpointUri, call, callable) : createAndPrepareHttpMethod(request, call, callable); trace("invokeRemoteCall", "executing httpMethod" + httpMethod); //$NON-NLS-1$ //$NON-NLS-2$ // execute method byte[] responseBody = null; @@ -239,7 +238,7 @@ public class RestClientService extends AbstractRestClientService { addRequestHeaders(httpMethod, call, callable); // handle authentication setupAuthenticaton(httpClient, httpMethod); - // setup http method config (redirects, timesouts, etc) + // setup http method config (redirects, timeouts, etc) setupHttpMethod(httpMethod, call, callable); } -- cgit v1.2.3