diff --git a/CHANGELOG.md b/CHANGELOG.md index 460b51592..6fb0c8518 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,14 +10,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - oas 3.0 base path handling (See issue [#297](https://github.com/Axway-API-Management-Plus/apim-cli/issues/297) - BackendBasepath problem exporting SOAP API with apim-cli (See issue [#299](https://github.com/Axway-API-Management-Plus/apim-cli/issues/299) +- Importing SOAP API with apim-cli adds "+" instead of spaces for the Backend API name (See issue [#301](https://github.com/Axway-API-Management-Plus/apim-cli/issues/301) ### Changed +- Added new parameter disableCompression. The parameter enables logging API Gateway responses for debugging. + - Usage - **api get -u apiadmin -p Space*Salt*25 -h 208.67.129.25 -port 8075 -n "PetStore 3.0" -o json -disableCompression** + - Enable http client header and payload logging using jvm -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog -Dorg.apache.commons.logging.simplelog.showdatetime=true -Dorg.apache.commons.logging.simplelog.log.org.apache.http=DEBUG - If backendBasepath is present in api-config.json, Openapi (OAS 3) servers.url will be modified based on the values. E.g - If open api servers.url is /api/v3 and backendBasepath is https://backend, the openapi server.url will be replaced with https://backend/api/v3 - If open api servers.url is https://petstore.swagger.io/api/v3 and backendBasepath is https://backend, the openapi server.url will be replaced with https://backend/api/v3 - If open api servers.url is https://petstore.swagger.io/api/v3 and backendBasepath is https://backend/api, the openapi server.url will be replaced with https://backend/api/api/v3 - ## [1.12.2] 2022-07-28 ### Fixed diff --git a/modules/apim-adapter/src/main/java/com/axway/apim/lib/CoreCLIOptions.java b/modules/apim-adapter/src/main/java/com/axway/apim/lib/CoreCLIOptions.java index 77a30cd56..664a6a1d5 100644 --- a/modules/apim-adapter/src/main/java/com/axway/apim/lib/CoreCLIOptions.java +++ b/modules/apim-adapter/src/main/java/com/axway/apim/lib/CoreCLIOptions.java @@ -45,9 +45,8 @@ public Parameters getParams() throws AppException { params.setProxyUsername(getValue("httpProxyUsername")); params.setProxyPassword(getValue("httpProxyPassword")); params.setRetryDelay(getValue("retryDelay")); - - - return (Parameters) params; + params.setDisableCompression(hasOption("disableCompression")); + return params; } @Override @@ -159,6 +158,10 @@ public void addOptions() { option.setRequired(false); option.setArgName("true"); cliOptions.addInternalOption(option); + + option = new Option("disableCompression", false, "Disable Http Client gzip Compression"); + option.setRequired(false); + cliOptions.addInternalOption(option); } @Override diff --git a/modules/apim-adapter/src/main/java/com/axway/apim/lib/CoreParameters.java b/modules/apim-adapter/src/main/java/com/axway/apim/lib/CoreParameters.java index 877eb50f9..746a6d900 100644 --- a/modules/apim-adapter/src/main/java/com/axway/apim/lib/CoreParameters.java +++ b/modules/apim-adapter/src/main/java/com/axway/apim/lib/CoreParameters.java @@ -108,6 +108,8 @@ public static Mode valueOfDefault(String key) { private String proxyPassword; private int retryDelay; + + private boolean disableCompression; public CoreParameters() { super(); @@ -544,6 +546,14 @@ public List getEnabledCacheTypes() { return null; } + public boolean isDisableCompression() { + return disableCompression; + } + + public void setDisableCompression(boolean disableCompression) { + this.disableCompression = disableCompression; + } + @Override public String toString() { return "[hostname=" + hostname + ", username=" + username + ", stage=" + stage + "]"; diff --git a/modules/apim-adapter/src/main/java/com/axway/apim/lib/utils/rest/APIMHttpClient.java b/modules/apim-adapter/src/main/java/com/axway/apim/lib/utils/rest/APIMHttpClient.java index 18d53c629..c8c8207ed 100644 --- a/modules/apim-adapter/src/main/java/com/axway/apim/lib/utils/rest/APIMHttpClient.java +++ b/modules/apim-adapter/src/main/java/com/axway/apim/lib/utils/rest/APIMHttpClient.java @@ -120,6 +120,8 @@ private void createConnection(URI uri) throws AppException { } defaultRequestConfig.setProxy(proxyHost); } + if(params.isDisableCompression()) + clientBuilder.disableContentCompression(); clientBuilder.setDefaultRequestConfig(defaultRequestConfig.build()); this.httpClient = clientBuilder.build(); } catch (Exception e) { diff --git a/modules/apim-adapter/src/test/java/com/axway/lib/CoreCLIOptionsTest.java b/modules/apim-adapter/src/test/java/com/axway/lib/CoreCLIOptionsTest.java index f1cf0e799..23a4cf0fd 100644 --- a/modules/apim-adapter/src/test/java/com/axway/lib/CoreCLIOptionsTest.java +++ b/modules/apim-adapter/src/test/java/com/axway/lib/CoreCLIOptionsTest.java @@ -115,4 +115,21 @@ public void testAPIBasePathParam() throws ParseException, AppException { Assert.assertEquals(params.getApiBasepath(), "/fr/apim/v13/portal"); } + + @Test + public void testDisableCompression() throws AppException { + String[] args = {"-disableCompression"}; + CLIOptions options = SampleCLIOptions.create(args); + CoreParameters params = (CoreParameters) options.getParams(); + Assert.assertEquals(params.isDisableCompression(), true); + + } + @Test + public void testDisableCompressionNegative() throws AppException { + String[] args = {""}; + CLIOptions options = SampleCLIOptions.create(args); + CoreParameters params = (CoreParameters) options.getParams(); + Assert.assertEquals(params.isDisableCompression(), false); + + } }