diff options
Diffstat (limited to 'common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpRequest.java')
-rw-r--r-- | common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpRequest.java | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpRequest.java b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpRequest.java index 57e5cb2bed..7deac29d67 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpRequest.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpRequest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,22 +17,18 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.common.http.client.api; +import java.util.Properties; import org.apache.http.HttpEntity; import org.openecomp.sdc.common.http.config.HttpClientConfig; -import java.util.Properties; - //TODO- remove all static and use instance methods for better testing public abstract class HttpRequest { - static final Properties defaultHeaders = null; + static final Properties defaultHeaders = null; static final HttpClientConfig defaultConfig = new HttpClientConfig(); - - private HttpRequest() { } @@ -46,7 +42,7 @@ public abstract class HttpRequest { public static HttpResponse<String> get(String url, Properties headers) throws HttpExecuteException { return get(url, headers, defaultConfig); } - + public static HttpResponse<String> get(String url, HttpClientConfig config) throws HttpExecuteException { return get(url, defaultHeaders, config); } @@ -84,7 +80,7 @@ public abstract class HttpRequest { public static HttpResponse<String> put(String url, Properties headers, HttpEntity entity) throws HttpExecuteException { return put(url, headers, entity, defaultConfig); } - + public static HttpResponse<String> put(String url, HttpEntity entity, HttpClientConfig config) throws HttpExecuteException { return put(url, defaultHeaders, entity, config); } @@ -103,7 +99,7 @@ public abstract class HttpRequest { public static HttpResponse<String> post(String url, Properties headers, HttpEntity entity) throws HttpExecuteException { return post(url, headers, entity, defaultConfig); } - + public static HttpResponse<String> post(String url, HttpEntity entity, HttpClientConfig config) throws HttpExecuteException { return post(url, defaultHeaders, entity, config); } @@ -111,7 +107,7 @@ public abstract class HttpRequest { public static HttpResponse<String> post(String url, Properties headers, HttpEntity entity, HttpClientConfig config) throws HttpExecuteException { return HttpRequestHandler.get().post(url, headers, entity, config); } - + /* * PATCH */ @@ -122,7 +118,7 @@ public abstract class HttpRequest { public static HttpResponse<String> patch(String url, Properties headers, HttpEntity entity) throws HttpExecuteException { return patch(url, headers, entity, defaultConfig); } - + public static HttpResponse<String> patch(String url, HttpEntity entity, HttpClientConfig config) throws HttpExecuteException { return patch(url, defaultHeaders, entity, config); } @@ -130,7 +126,7 @@ public abstract class HttpRequest { public static HttpResponse<String> patch(String url, Properties headers, HttpEntity entity, HttpClientConfig config) throws HttpExecuteException { return HttpRequestHandler.get().patch(url, headers, entity, config); } - + /* * DELETE */ @@ -141,7 +137,7 @@ public abstract class HttpRequest { public static HttpResponse<String> delete(String url, Properties headers) throws HttpExecuteException { return delete(url, headers, defaultConfig); } - + public static HttpResponse<String> delete(String url, HttpClientConfig config) throws HttpExecuteException { return delete(url, defaultHeaders, config); } @@ -149,7 +145,7 @@ public abstract class HttpRequest { public static HttpResponse<String> delete(String url, Properties headers, HttpClientConfig config) throws HttpExecuteException { return HttpRequestHandler.get().delete(url, headers, config); } - + public static void destroy() { HttpRequestHandler.get().destroy(); } |