diff --git a/components/apimgt/org.wso2.carbon.apimgt.api/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.api/pom.xml index 18194ffa01d1..81f7996557e0 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.api/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.api/pom.xml @@ -11,7 +11,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/ExceptionCodes.java b/components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/ExceptionCodes.java index d229e7f4067d..3608867380bb 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/ExceptionCodes.java +++ b/components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/ExceptionCodes.java @@ -163,6 +163,8 @@ public enum ExceptionCodes implements ErrorHandler { 400, "Name of the gateway is read only"), GATEWAY_ENVIRONMENT_VHOST_NOT_PROVIDED(900511, "Gateway Environment virtual hosts name not provided", 400, "Gateway Environment VHOST name not provided"), + INVALID_VHOST(900512, "Invalid virtual host name provided", + 400, "Virtual host with provided vhost name does not exist"), // Workflow related codes WORKFLOW_EXCEPTION(900550, "Workflow error", 500, diff --git a/components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/VHost.java b/components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/VHost.java index 482cb73dee5e..a726850d3bbd 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/VHost.java +++ b/components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/VHost.java @@ -27,12 +27,15 @@ * This class represent an Virtual Host */ public class VHost { + // host name from the http endpoint private String host; private String httpContext = ""; private Integer httpPort = -1; private Integer httpsPort = -1; private Integer wsPort = DEFAULT_WS_PORT; + private String wsHost; private Integer wssPort = DEFAULT_WSS_PORT; + private String wssHost; private Integer websubHttpPort = DEFAULT_WEBSUB_HTTP_PORT; private Integer websubHttpsPort = DEFAULT_WEBSUB_HTTPS_PORT; @@ -95,6 +98,14 @@ public void setWsPort(Integer wsPort) { this.wsPort = wsPort; } + public String getWsHost() { + return wsHost; + } + + public void setWsHost(String wsHost) { + this.wsHost = wsHost; + } + public Integer getWssPort() { return wssPort; } @@ -103,6 +114,14 @@ public void setWssPort(Integer wssPort) { this.wssPort = wssPort; } + public String getWssHost() { + return wssHost; + } + + public void setWssHost(String wssHost) { + this.wssHost = wssHost; + } + public Integer getWebsubHttpPort() { return websubHttpPort; } @@ -120,27 +139,27 @@ public void setWebsubHttpsPort(Integer websubHttpsPort) { } public String getHttpUrl() { - return getUrl("http", httpPort == DEFAULT_HTTP_PORT ? "" : ":" + httpPort, httpContext); + return getUrl("http", host, httpPort == DEFAULT_HTTP_PORT ? "" : ":" + httpPort, httpContext); } public String getHttpsUrl() { - return getUrl("https", httpsPort == DEFAULT_HTTPS_PORT ? "" : ":" + httpsPort, httpContext); + return getUrl("https", host, httpsPort == DEFAULT_HTTPS_PORT ? "" : ":" + httpsPort, httpContext); } public String getWsUrl() { - return getUrl("ws", wsPort == DEFAULT_HTTP_PORT ? "" : ":" + wsPort, ""); + return getUrl("ws", wsHost, wsPort == DEFAULT_HTTP_PORT ? "" : ":" + wsPort, ""); } public String getWssUrl() { - return getUrl("wss", wssPort == DEFAULT_HTTPS_PORT ? "" : ":" + wssPort, ""); + return getUrl("wss", wssHost, wssPort == DEFAULT_HTTPS_PORT ? "" : ":" + wssPort, ""); } - private String getUrl(String protocol, String port, String context) { + private String getUrl(String protocol, String hostName, String port, String context) { // {protocol}://{host}{port}{context} if (StringUtils.isNotEmpty(context) && !context.startsWith("/")) { context = "/" + context; } - return String.format("%s://%s%s%s", protocol, host, port, context); + return String.format("%s://%s%s%s", protocol, hostName, port, context); } public static VHost fromEndpointUrls(String[] endpoints) throws APIManagementException { @@ -178,11 +197,13 @@ public static VHost fromEndpointUrls(String[] endpoints) throws APIManagementExc // URL is not parsing for wss protocols, hence change to https url = new URL(HTTPS_PROTOCOL + PROTOCOL_SEPARATOR + elem[1]); vhost.setWssPort(url.getPort() < 0 ? DEFAULT_WSS_PORT : url.getPort()); + vhost.setWssHost(url.getHost()); break; case WS_PROTOCOL: // URL is not parsing for ws protocols, hence change to http url = new URL(HTTP_PROTOCOL + PROTOCOL_SEPARATOR + elem[1]); vhost.setWsPort(url.getPort() < 0 ? DEFAULT_WS_PORT : url.getPort()); + vhost.setWsHost(url.getHost()); break; case WEBSUB_HTTP_PROTOCOL: url = new URL(HTTP_PROTOCOL + PROTOCOL_SEPARATOR + elem[1]); @@ -203,6 +224,14 @@ public static VHost fromEndpointUrls(String[] endpoints) throws APIManagementExc throw new APIManagementException("Error while building VHost, missing required HTTP or HTTPS endpoint"); } + // If WebSocket host name of Vhost is empty, use HTTP/HTTPS endpoint hostname + if ((vhost.getWsHost() == null) || (StringUtils.isEmpty(vhost.getWsHost()))) { + vhost.setWsHost(vhost.getHost()); + } + if ((vhost.getWssHost() == null) || (StringUtils.isEmpty(vhost.getWssHost()))) { + vhost.setWssHost(vhost.getHost()); + } + return vhost; } diff --git a/components/apimgt/org.wso2.carbon.apimgt.broker.lifecycle/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.broker.lifecycle/pom.xml index ab5e3779b77c..da0962c2eed5 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.broker.lifecycle/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.broker.lifecycle/pom.xml @@ -4,7 +4,7 @@ apimgt org.wso2.carbon.apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.cache.invalidation/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.cache.invalidation/pom.xml index df07243a8f40..958afea8c5a7 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.cache.invalidation/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.cache.invalidation/pom.xml @@ -19,7 +19,7 @@ apimgt org.wso2.carbon.apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT 4.0.0 diff --git a/components/apimgt/org.wso2.carbon.apimgt.cleanup.service/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.cleanup.service/pom.xml index dec9a7a283ff..f1c7e0ccbba1 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.cleanup.service/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.cleanup.service/pom.xml @@ -19,7 +19,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.common.analytics/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.common.analytics/pom.xml index 90b70df7d32d..1ee5147d2387 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.common.analytics/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.common.analytics/pom.xml @@ -3,7 +3,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml 4.0.0 diff --git a/components/apimgt/org.wso2.carbon.apimgt.common.gateway/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.common.gateway/pom.xml index 0e351975f756..74d11cf905b3 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.common.gateway/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.common.gateway/pom.xml @@ -3,7 +3,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml 4.0.0 diff --git a/components/apimgt/org.wso2.carbon.apimgt.common.jms/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.common.jms/pom.xml index 7777977ba84b..e1094b940933 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.common.jms/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.common.jms/pom.xml @@ -4,7 +4,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml 4.0.0 diff --git a/components/apimgt/org.wso2.carbon.apimgt.core/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.core/pom.xml index 7c53c0e5398e..7e326d7e7230 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.core/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.core/pom.xml @@ -5,7 +5,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.devops.impl/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.devops.impl/pom.xml index 71e0f5578f35..4cf37eb17c2c 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.devops.impl/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.devops.impl/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.eventing.hub/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.eventing.hub/pom.xml index 76bbec3a12a4..eea8d9639cc9 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.eventing.hub/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.eventing.hub/pom.xml @@ -20,7 +20,7 @@ apimgt org.wso2.carbon.apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.eventing/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.eventing/pom.xml index 03b508e16fe7..54a861dfbf60 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.eventing/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.eventing/pom.xml @@ -20,7 +20,7 @@ apimgt org.wso2.carbon.apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml index b5cfe106d545..328e082749db 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml @@ -19,7 +19,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/APILoggerManager.java b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/APILoggerManager.java index 91e6e93a8e5a..8133bfeca1d0 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/APILoggerManager.java +++ b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/APILoggerManager.java @@ -21,9 +21,8 @@ import org.apache.commons.codec.binary.Base64; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.util.EntityUtils; import org.json.JSONArray; @@ -49,8 +48,6 @@ public class APILoggerManager { private Map, String> logProperties = new HashMap<>(); private static final APILoggerManager apiLoggerManager = new APILoggerManager(); private final EventHubConfigurationDto eventHubConfigurationDto; - public static final int RETRIEVAL_RETRIES = 15; - public static final int RETRIEVAL_TIMEOUT_IN_SECONDS = 15; public static final String UTF8 = "UTF-8"; public void initializeAPILoggerList() { @@ -124,35 +121,13 @@ private String invokeService(String path, String tenantDomain) throws IOExceptio method.setHeader(APIConstants.HEADER_TENANT, tenantDomain); } HttpClient httpClient = APIUtil.getHttpClient(servicePort, serviceProtocol); - - HttpResponse httpResponse = null; - int retryCount = 0; - boolean retry; - do { - try { - httpResponse = httpClient.execute(method); - retry = false; - } catch (IOException ex) { - retryCount++; - if (retryCount < RETRIEVAL_RETRIES) { - retry = true; - log.warn("Failed retrieving " + path + " from remote endpoint: " + ex.getMessage() - + ". Retrying after " + RETRIEVAL_TIMEOUT_IN_SECONDS + - " seconds."); - try { - Thread.sleep(RETRIEVAL_TIMEOUT_IN_SECONDS * 1000L); - } catch (InterruptedException e) { - // Ignore - } - } else { - throw new APIManagementException("Error while calling internal service", ex); - } - } - } while (retry); - if (HttpStatus.SC_OK != httpResponse.getStatusLine().getStatusCode()) { - log.error("Could not retrieve subscriptions for tenantDomain : " + tenantDomain); - throw new APIManagementException("Error while retrieving subscription from " + path); + try (CloseableHttpResponse httpResponse = APIUtil.executeHTTPRequestWithRetries(method, httpClient)){ + return EntityUtils.toString(httpResponse.getEntity(), UTF8); + } catch (APIManagementException e) { + throw new APIManagementException("Error while calling internal service", e); } - return EntityUtils.toString(httpResponse.getEntity(), UTF8); + + + } } diff --git a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/EndpointCertificateDeployer.java b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/EndpointCertificateDeployer.java index 7cf721d2c71b..af0991c33819 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/EndpointCertificateDeployer.java +++ b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/EndpointCertificateDeployer.java @@ -132,7 +132,7 @@ private CloseableHttpResponse invokeService(String endpoint, String tenantDomain HttpClient httpClient = APIUtil.getHttpClient(port, protocol); try { - return APIUtil.executeHTTPRequest(method, httpClient); + return APIUtil.executeHTTPRequestWithRetries(method, httpClient); } catch (APIManagementException e) { throw new ArtifactSynchronizerException(e); } diff --git a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/GoogleAnalyticsConfigDeployer.java b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/GoogleAnalyticsConfigDeployer.java index e89037c919aa..4167bc90c032 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/GoogleAnalyticsConfigDeployer.java +++ b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/GoogleAnalyticsConfigDeployer.java @@ -118,7 +118,7 @@ private CloseableHttpResponse invokeService(String endpoint, String tenantDomain HttpClient httpClient = APIUtil.getHttpClient(port, protocol); try { - return APIUtil.executeHTTPRequest(method, httpClient); + return APIUtil.executeHTTPRequestWithRetries(method, httpClient); } catch (APIManagementException e) { throw new ArtifactSynchronizerException(e); } diff --git a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/logging/APILogHandler.java b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/logging/APILogHandler.java index 0ff2a177a089..3e7a1dd7c0e6 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/logging/APILogHandler.java +++ b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/logging/APILogHandler.java @@ -109,7 +109,7 @@ public static void logAPI(String flow, MessageContext messageContext) { private static void addBasicProperties(JSONObject logMessage, MessageContext messageContext, String flow) { logMessage.put("apiTo", messageContext.getProperty(API_TO)); - logMessage.put("correlationId", messageContext.getProperty(APIConstants.CORRELATION_ID)); + logMessage.put("correlationId", messageContext.getProperty("correlation_id")); logMessage.put("flow", flow); String verb = (String) ((Axis2MessageContext) messageContext).getAxis2MessageContext() .getProperty(APIConstants.DigestAuthConstants.HTTP_METHOD); diff --git a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/security/basicauth/BasicAuthAuthenticator.java b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/security/basicauth/BasicAuthAuthenticator.java index bc7c0c421169..e711a2cb5958 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/security/basicauth/BasicAuthAuthenticator.java +++ b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/security/basicauth/BasicAuthAuthenticator.java @@ -264,7 +264,7 @@ private String[] extractBasicAuthCredentials(String basicAuthHeader) throws APIS String basicAuthKey = new String(Base64.decode( basicAuthHeader.substring(basicAuthKeyHeaderSegment.length() + 1).trim())); if (basicAuthKey.contains(":")) { - return basicAuthKey.split(":"); + return basicAuthKey.split(":", 2); } else { log.error("Basic Authentication: Invalid Basic Auth token"); throw new APISecurityException(APISecurityConstants.API_AUTH_INVALID_CREDENTIALS, diff --git a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/jwt/RevokedJWTTokensRetriever.java b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/jwt/RevokedJWTTokensRetriever.java index 4fca13495583..63fa846f0b9f 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/jwt/RevokedJWTTokensRetriever.java +++ b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/jwt/RevokedJWTTokensRetriever.java @@ -22,14 +22,16 @@ import org.apache.commons.codec.binary.Base64; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.util.EntityUtils; +import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.gateway.dto.RevokedJWTTokenDTO; import org.wso2.carbon.apimgt.gateway.internal.ServiceReferenceHolder; import org.wso2.carbon.apimgt.impl.APIConstants; import org.wso2.carbon.apimgt.impl.dto.EventHubConfigurationDto; +import org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.exception.DataLoadingException; import org.wso2.carbon.apimgt.impl.utils.APIUtil; import java.io.IOException; @@ -38,14 +40,14 @@ import java.util.Timer; import java.util.TimerTask; +import static org.wso2.carbon.apimgt.impl.APIConstants.DigestAuthConstants.CHARSET; + /** * Class which is responsible to fetch the revoked JWT signatures via webservice database during startup */ public class RevokedJWTTokensRetriever extends TimerTask { private static final Log log = LogFactory.getLog(RevokedJWTTokensRetriever.class); - private static final int revokedJWTTokensRetrievalTimeoutInSeconds = 15; - private static final int revokedJWTTokensRetrievalRetries = 15; @Override public void run() { @@ -73,32 +75,17 @@ private RevokedJWTTokenDTO[] retrieveRevokedJWTTokensData() { int keyMgtPort = keyMgtURL.getPort(); String keyMgtProtocol = keyMgtURL.getProtocol(); HttpClient httpClient = APIUtil.getHttpClient(keyMgtPort, keyMgtProtocol); - HttpResponse httpResponse = null; - int retryCount = 0; - boolean retry; - do { - try { - httpResponse = httpClient.execute(method); - retry = false; - } catch (IOException ex) { - retryCount++; - if (retryCount < revokedJWTTokensRetrievalRetries) { - retry = true; - log.warn("Failed retrieving revoked JWT token signatures from remote endpoint: " + - ex.getMessage() + ". Retrying after " + revokedJWTTokensRetrievalTimeoutInSeconds + - " seconds..."); - Thread.sleep(revokedJWTTokensRetrievalTimeoutInSeconds * 1000); - } else { - throw ex; - } - } - } while (retry); + String responseString; + try (CloseableHttpResponse httpResponse = APIUtil.executeHTTPRequestWithRetries(method, httpClient)) { + responseString = EntityUtils.toString(httpResponse.getEntity(), CHARSET); + } catch (APIManagementException e) { + throw new DataLoadingException("Error while retrieving revoked JWT tokens", e); + } - String responseString = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); if (responseString != null && !responseString.isEmpty()) { return new Gson().fromJson(responseString, RevokedJWTTokenDTO[].class); } - } catch (IOException | InterruptedException e) { + } catch (IOException | DataLoadingException e) { log.error("Exception when retrieving revoked JWT tokens from remote endpoint ", e); } return null; diff --git a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/throttling/util/BlockingConditionRetriever.java b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/throttling/util/BlockingConditionRetriever.java index 9d0e7b6a45c0..a302e7ba9c60 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/throttling/util/BlockingConditionRetriever.java +++ b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/throttling/util/BlockingConditionRetriever.java @@ -21,16 +21,18 @@ import org.apache.commons.codec.binary.Base64; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.util.EntityUtils; +import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.gateway.dto.BlockConditionsDTO; import org.wso2.carbon.apimgt.gateway.internal.ServiceReferenceHolder; import org.wso2.carbon.apimgt.gateway.throttling.ThrottleDataHolder; import org.wso2.carbon.apimgt.gateway.utils.GatewayUtils; import org.wso2.carbon.apimgt.impl.APIConstants; import org.wso2.carbon.apimgt.impl.dto.EventHubConfigurationDto; +import org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.exception.DataLoadingException; import org.wso2.carbon.apimgt.impl.utils.APIUtil; import java.io.IOException; @@ -39,10 +41,10 @@ import java.util.Timer; import java.util.TimerTask; +import static org.wso2.carbon.apimgt.impl.APIConstants.DigestAuthConstants.CHARSET; + public class BlockingConditionRetriever extends TimerTask { private static final Log log = LogFactory.getLog(BlockingConditionRetriever.class); - private static final int blockConditionsDataRetrievalTimeoutInSeconds = 15; - private static final int blockConditionsDataRetrievalRetries = 15; @Override public void run() { @@ -71,40 +73,17 @@ private BlockConditionsDTO retrieveBlockConditionsData() { int keyMgtPort = eventHubUrl.getPort(); String protocol = eventHubUrl.getProtocol(); HttpClient httpClient = APIUtil.getHttpClient(keyMgtPort, protocol); - HttpResponse httpResponse = null; - int retryCount = 0; - boolean retry = true; - do { - try { - httpResponse = httpClient.execute(method); - if (httpResponse.getStatusLine().getStatusCode() == 200) { - retry = false; - } - } catch (IOException ex) { - if (retryCount >= blockConditionsDataRetrievalRetries) { - throw ex; - }else{ - log.warn("Failed retrieving Blocking Conditions from remote endpoint: " + ex.getMessage() - + ". Retrying after " + blockConditionsDataRetrievalTimeoutInSeconds + " seconds..."); } - } - if (retry) { - if (retryCount < blockConditionsDataRetrievalRetries) { - log.warn("Failed retrieving Blocking Conditions from remote endpoint:. Retrying after " - + blockConditionsDataRetrievalTimeoutInSeconds + " seconds..."); - Thread.sleep(blockConditionsDataRetrievalTimeoutInSeconds * 1000); - } else { - retry = false; - } - retryCount++; - } - - } while (retry); + String responseString; + try (CloseableHttpResponse httpResponse = APIUtil.executeHTTPRequestWithRetries(method, httpClient)) { + responseString = EntityUtils.toString(httpResponse.getEntity(), CHARSET); + } catch (APIManagementException e) { + throw new DataLoadingException("Error while retrieving Blocking Conditions", e); + } - String responseString = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); if (responseString != null && !responseString.isEmpty()) { return new Gson().fromJson(responseString, BlockConditionsDTO.class); } - } catch (IOException | InterruptedException e) { + } catch (IOException | DataLoadingException e) { log.error("Exception when retrieving Blocking Conditions from remote endpoint ", e); } return null; diff --git a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/throttling/util/KeyTemplateRetriever.java b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/throttling/util/KeyTemplateRetriever.java index 137164973022..99646ae0f2e2 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/throttling/util/KeyTemplateRetriever.java +++ b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/throttling/util/KeyTemplateRetriever.java @@ -20,18 +20,20 @@ import org.apache.commons.codec.binary.Base64; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.util.EntityUtils; import org.json.simple.JSONArray; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; +import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.gateway.internal.ServiceReferenceHolder; import org.wso2.carbon.apimgt.gateway.throttling.ThrottleDataHolder; import org.wso2.carbon.apimgt.gateway.utils.GatewayUtils; import org.wso2.carbon.apimgt.impl.APIConstants; import org.wso2.carbon.apimgt.impl.dto.EventHubConfigurationDto; +import org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.exception.DataLoadingException; import org.wso2.carbon.apimgt.impl.utils.APIUtil; import java.io.IOException; @@ -42,10 +44,10 @@ import java.util.Timer; import java.util.TimerTask; +import static org.wso2.carbon.apimgt.impl.APIConstants.DigestAuthConstants.CHARSET; + public class KeyTemplateRetriever extends TimerTask { private static final Log log = LogFactory.getLog(KeyTemplateRetriever.class); - private static final int keyTemplateRetrievalTimeoutInSeconds = 15; - private static final int keyTemplateRetrievalRetries = 15; @Override public void run() { @@ -75,36 +77,13 @@ private String[] retrieveKeyTemplateData() { int keyMgtPort = keyMgtURL.getPort(); String keyMgtProtocol = keyMgtURL.getProtocol(); HttpClient httpClient = APIUtil.getHttpClient(keyMgtPort, keyMgtProtocol); - HttpResponse httpResponse = null; - int retryCount = 0; - boolean retry = true; - do { - try { - httpResponse = httpClient.execute(method); - if (httpResponse.getStatusLine().getStatusCode() == 200) { - retry = false; - } - } catch (IOException ex) { - if (retryCount >= keyTemplateRetrievalRetries) { - throw ex; - }else{ - log.warn("Failed retrieving throttling data from remote endpoint: " + ex.getMessage() - + ". Retrying after " + keyTemplateRetrievalTimeoutInSeconds + " seconds..."); - } - } - if (retry) { - if (retryCount < keyTemplateRetrievalRetries) { - log.warn("Failed retrieving throttling data from remote endpoint. Retrying after " - + keyTemplateRetrievalTimeoutInSeconds + " seconds..."); - Thread.sleep(keyTemplateRetrievalTimeoutInSeconds * 1000); - } else { - retry = false; - } - retryCount++; - } - } while (retry); + String responseString; + try (CloseableHttpResponse httpResponse = APIUtil.executeHTTPRequestWithRetries(method, httpClient)) { + responseString = EntityUtils.toString(httpResponse.getEntity(), CHARSET); + } catch (APIManagementException e) { + throw new DataLoadingException("Error while retrieving throttling data", e); + } - String responseString = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); if (responseString != null && !responseString.isEmpty()) { Object jsonObject = new JSONParser().parse(responseString); if (jsonObject instanceof JSONArray) { @@ -114,7 +93,7 @@ private String[] retrieveKeyTemplateData() { log.error("Invalid throttling data response: " + responseString); } } - } catch (IOException | InterruptedException | ParseException e) { + } catch (IOException | ParseException | DataLoadingException e) { log.error("Exception when retrieving throttling data from remote endpoint ", e); } return null; diff --git a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/throttling/util/BlockingConditionRetrieverTest.java b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/throttling/util/BlockingConditionRetrieverTest.java index 17eff36a8954..d4d48a0cb8ad 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/throttling/util/BlockingConditionRetrieverTest.java +++ b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/throttling/util/BlockingConditionRetrieverTest.java @@ -17,10 +17,9 @@ */ package org.wso2.carbon.apimgt.gateway.throttling.util; -import org.apache.http.HttpResponse; -import org.apache.http.ProtocolVersion; import org.apache.http.StatusLine; import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.entity.BasicHttpEntity; import org.junit.Assert; @@ -49,14 +48,15 @@ public void run() throws Exception { ".super\"}],\"user\":[\"admin\"],\"custom\":[]}"; PowerMockito.mockStatic(APIUtil.class); HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + CloseableHttpResponse httpResponse = Mockito.mock(CloseableHttpResponse.class); BasicHttpEntity httpEntity = new BasicHttpEntity(); httpEntity.setContent(new ByteArrayInputStream(content.getBytes())); Mockito.when(httpResponse.getEntity()).thenReturn(httpEntity); StatusLine status = Mockito.mock(StatusLine.class); Mockito.when(status.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getStatusLine()).thenReturn(status); - Mockito.when(httpClient.execute(Mockito.any(HttpGet.class))).thenReturn(httpResponse); + Mockito.when(APIUtil.executeHTTPRequestWithRetries(Mockito.any(HttpGet.class), Mockito.any(HttpClient.class))) + .thenReturn(httpResponse); BDDMockito.given(APIUtil.getHttpClient(Mockito.anyInt(), Mockito.anyString())).willReturn(httpClient); EventHubConfigurationDto eventHubConfigurationDto = new EventHubConfigurationDto(); eventHubConfigurationDto.setUsername("admin"); diff --git a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/throttling/util/KeyTemplateRetrieverTest.java b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/throttling/util/KeyTemplateRetrieverTest.java index c9f9b6c5a4b9..8f0f5f693018 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/throttling/util/KeyTemplateRetrieverTest.java +++ b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/throttling/util/KeyTemplateRetrieverTest.java @@ -18,9 +18,9 @@ package org.wso2.carbon.apimgt.gateway.throttling.util; -import org.apache.http.HttpResponse; import org.apache.http.StatusLine; import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.entity.BasicHttpEntity; import org.junit.Assert; @@ -33,7 +33,6 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.wso2.carbon.apimgt.gateway.throttling.ThrottleDataHolder; import org.wso2.carbon.apimgt.impl.dto.EventHubConfigurationDto; -import org.wso2.carbon.apimgt.impl.dto.ThrottleProperties; import org.wso2.carbon.apimgt.impl.utils.APIUtil; import java.io.ByteArrayInputStream; @@ -52,11 +51,13 @@ public void run() throws Exception { String content = "[\"$userId\",\"$apiContext\",\"$apiVersion\"]"; PowerMockito.mockStatic(APIUtil.class); HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + CloseableHttpResponse httpResponse = Mockito.mock(CloseableHttpResponse.class); BasicHttpEntity httpEntity = new BasicHttpEntity(); httpEntity.setContent(new ByteArrayInputStream(content.getBytes())); Mockito.when(httpResponse.getEntity()).thenReturn(httpEntity); Mockito.when(httpClient.execute(Mockito.any(HttpGet.class))).thenReturn(httpResponse); + Mockito.when(APIUtil.executeHTTPRequestWithRetries(Mockito.any(HttpGet.class), Mockito.any(HttpClient.class))) + .thenReturn(httpResponse); StatusLine status = Mockito.mock(StatusLine.class); Mockito.when(status.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getStatusLine()).thenReturn(status); diff --git a/components/apimgt/org.wso2.carbon.apimgt.impl/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.impl/pom.xml index 9debbb354ae0..6954c5e36835 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.impl/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.impl/pom.xml @@ -12,7 +12,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/AbstractAPIManager.java b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/AbstractAPIManager.java index 367765623b04..bc08ab5c9744 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/AbstractAPIManager.java +++ b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/AbstractAPIManager.java @@ -472,10 +472,6 @@ public DocumentationContent getDocumentationContent(String apiId, String docId, DocumentationContent docContent = null; if (content != null) { docContent = DocumentMapper.INSTANCE.toDocumentationContent(content); - } else { - String msg = "Failed to get the document content. Artifact corresponding to document id " + docId - + " does not exist"; - throw new APIMgtResourceNotFoundException(msg); } return docContent; } catch (DocumentationPersistenceException e) { diff --git a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java index 11cac8c85c70..94cfa77f0fa2 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java +++ b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java @@ -14060,6 +14060,9 @@ private List getVhostGatewayEnvironments(Connection connection, Integer e vhost.setHttpsPort(httpsPort); vhost.setWsPort(wsPort); vhost.setWssPort(wssPort); + // Since DB does not contain columns for wsHost and wssHost, host is used + vhost.setWsHost(host); + vhost.setWssHost(host); vhosts.add(vhost); } } diff --git a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/restapi/publisher/ApisApiServiceImplUtils.java b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/restapi/publisher/ApisApiServiceImplUtils.java index 2dfdd60f7ec1..68ffddf7edc6 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/restapi/publisher/ApisApiServiceImplUtils.java +++ b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/restapi/publisher/ApisApiServiceImplUtils.java @@ -846,14 +846,33 @@ public static APIRevisionDeployment mapAPIRevisionDeploymentWithValidation(Strin final String errorMessage = "Gateway environment not found: " + environment; throw new APIManagementException(errorMessage, ExceptionCodes.from( ExceptionCodes.INVALID_GATEWAY_ENVIRONMENT, String.format("name '%s'", environment))); - } + if (mandatoryVHOST && StringUtils.isEmpty(vhost)) { // vhost is only required when deploying a revision, not required when un-deploying a revision // since the same scheme 'APIRevisionDeployment' is used for deploy and undeploy, handle it here. throw new APIManagementException("Required field 'vhost' not found in deployment", ExceptionCodes.GATEWAY_ENVIRONMENT_VHOST_NOT_PROVIDED); } + + List vhosts = environments.get(environment).getVhosts(); + boolean isVhostValidated = false; + for (VHost vhostItem : vhosts) { + //Checking the vhost is included in the available vhost list + if (vhostItem.getHost().equals(vhost)) { + isVhostValidated = true; + } else if (vhostItem.getWsHost().equals(vhost)) { + // This was added to preserve the functionality in case of Deploying a WebSocket API revision. + // For WebSocket APIs apiRevisionDeploymentDTO.getVhost() returns the wsHost + isVhostValidated = true; + vhost = vhostItem.getHost(); + } + } + + if (mandatoryVHOST && !isVhostValidated) { + throw new APIManagementException("Invalid Vhost: " + vhost, ExceptionCodes.INVALID_VHOST); + } + return mapApiRevisionDeployment(revisionId, vhost, displayOnDevportal, environment); } diff --git a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java index 9612120a4e09..6357ab25f873 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java +++ b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java @@ -490,6 +490,7 @@ public static CloseableHttpResponse executeHTTPRequestWithRetries(HttpRequestBas throws IOException, APIManagementException { CloseableHttpResponse httpResponse = null; + String path = method.getURI().getPath(); long retryDuration = retrievalTimeout; int retryCount = 0; boolean retry; @@ -497,15 +498,16 @@ public static CloseableHttpResponse executeHTTPRequestWithRetries(HttpRequestBas try { httpResponse = (CloseableHttpResponse) httpClient.execute(method); if (HttpStatus.SC_OK != httpResponse.getStatusLine().getStatusCode()) { - throw new DataLoadingException("Error while retrieving artifacts. " - + "Received response with status code "+ httpResponse.getStatusLine().getStatusCode()); + throw new DataLoadingException("Error while retrieving " + + path + ". Received response with status code " + + httpResponse.getStatusLine().getStatusCode()); } retry = false; } catch (IOException | DataLoadingException ex) { retryCount++; if (retryCount <= maxRetryCount) { retry = true; - log.error("Failed to retrieve from remote endpoint: " + ex.getMessage() + log.error("Failed to retrieve " + path + " from remote endpoint: " + ex.getMessage() + ". Retry attempt " + retryCount + " in " + (retryDuration / 1000) + " seconds."); try { @@ -518,7 +520,7 @@ public static CloseableHttpResponse executeHTTPRequestWithRetries(HttpRequestBas // Ignore } } else { - log.error("Failed to retrieve from remote endpoint. Maximum retry count exceeded." + log.error("Failed to retrieve " + path + " from remote endpoint. Maximum retry count exceeded." + ex.getMessage()); throw ex; } diff --git a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/VHostUtils.java b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/VHostUtils.java index fa9cba2be3fa..50c7610f2172 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/VHostUtils.java +++ b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/VHostUtils.java @@ -41,7 +41,9 @@ public static VHost getVhostFromEnvironment(Environment environment, String host defaultVhost.setHttpsPort(APIConstants.HTTPS_PROTOCOL_PORT); defaultVhost.setHttpPort(APIConstants.HTTP_PROTOCOL_PORT); defaultVhost.setWsPort(APIConstants.WS_PROTOCOL_PORT); + defaultVhost.setWsHost(host); defaultVhost.setWssPort(APIConstants.WSS_PROTOCOL_PORT); + defaultVhost.setWssHost(host); if (host == null && environment.getVhosts().size() > 0) { // VHost is NULL set first Vhost (set in deployment toml) diff --git a/components/apimgt/org.wso2.carbon.apimgt.internal.service/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.internal.service/pom.xml index 76927af5c6e3..08cda276d53e 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.internal.service/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.internal.service/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.jms.listener/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.jms.listener/pom.xml index 050634a927b2..275efaf47a8c 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.jms.listener/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.jms.listener/pom.xml @@ -4,7 +4,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml 4.0.0 diff --git a/components/apimgt/org.wso2.carbon.apimgt.keymgt.client/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.keymgt.client/pom.xml index ae2f4c865d51..a16ecc51fbf7 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.keymgt.client/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.keymgt.client/pom.xml @@ -16,7 +16,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.keymgt/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.keymgt/pom.xml index dc9a6b1887a9..9ec295aae857 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.keymgt/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.keymgt/pom.xml @@ -16,7 +16,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.keymgt/src/main/java/org/wso2/carbon/apimgt/keymgt/model/impl/SubscriptionDataLoaderImpl.java b/components/apimgt/org.wso2.carbon.apimgt.keymgt/src/main/java/org/wso2/carbon/apimgt/keymgt/model/impl/SubscriptionDataLoaderImpl.java index c52dadf37b38..c9d25dbca0a8 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.keymgt/src/main/java/org/wso2/carbon/apimgt/keymgt/model/impl/SubscriptionDataLoaderImpl.java +++ b/components/apimgt/org.wso2.carbon.apimgt.keymgt/src/main/java/org/wso2/carbon/apimgt/keymgt/model/impl/SubscriptionDataLoaderImpl.java @@ -21,11 +21,11 @@ import org.apache.commons.codec.binary.Base64; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.util.EntityUtils; +import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.impl.APIConstants; import org.wso2.carbon.apimgt.impl.dto.EventHubConfigurationDto; import org.wso2.carbon.apimgt.impl.dto.GatewayArtifactSynchronizerProperties; @@ -64,8 +64,6 @@ public class SubscriptionDataLoaderImpl implements SubscriptionDataLoader { private static final Log log = LogFactory.getLog(SubscriptionDataLoaderImpl.class); private EventHubConfigurationDto getEventHubConfigurationDto; private GatewayArtifactSynchronizerProperties gatewayArtifactSynchronizerProperties; - public static final int retrievalTimeoutInSeconds = 15; - public static final int retrievalRetries = 15; public static final String UTF8 = "UTF-8"; public SubscriptionDataLoaderImpl() { @@ -468,47 +466,17 @@ private String invokeService(String path, String tenantDomain) throws DataLoadin method.setHeader(APIConstants.HEADER_TENANT, tenantDomain); } HttpClient httpClient = APIUtil.getHttpClient(servicePort, serviceProtocol); - - HttpResponse httpResponse = null; - int retryCount = 0; - boolean retry = false; - do { - try { - httpResponse = httpClient.execute(method); - if (HttpStatus.SC_OK != httpResponse.getStatusLine().getStatusCode()) { - log.error("Could not retrieve subscriptions for tenantDomain: " + tenantDomain - + ". Received response with status code " - + httpResponse.getStatusLine().getStatusCode()); - throw new DataLoadingException("Error while retrieving subscription"); - } - retry = false; - } catch (IOException | DataLoadingException ex) { - retryCount++; - if (retryCount < retrievalRetries) { - retry = true; - log.warn("Failed retrieving " + path + " from remote endpoint: " + ex.getMessage() - + ". Retrying after " + retrievalTimeoutInSeconds + - " seconds."); - try { - Thread.sleep(retrievalTimeoutInSeconds * 1000); - } catch (InterruptedException e) { - // Ignore - } - } else { - throw ex; - } - } - } while (retry); - if (HttpStatus.SC_OK != httpResponse.getStatusLine().getStatusCode()) { - log.error("Could not retrieve subscriptions for tenantDomain : " + tenantDomain); - throw new DataLoadingException("Error while retrieving subscription from " + path); + String responseString; + try (CloseableHttpResponse httpResponse = APIUtil.executeHTTPRequestWithRetries(method, httpClient)) { + responseString = EntityUtils.toString(httpResponse.getEntity(), UTF8); + } catch (APIManagementException e) { + throw new DataLoadingException("Error while retrieving subscriptions", e); } - String responseString = EntityUtils.toString(httpResponse.getEntity(), UTF8); + if (log.isDebugEnabled()) { log.debug("Response : " + responseString); } return responseString; - } private byte[] getServiceCredentials(EventHubConfigurationDto eventHubConfigurationDto) { diff --git a/components/apimgt/org.wso2.carbon.apimgt.notification/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.notification/pom.xml index cb0c9bd221d2..1f292a060c88 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.notification/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.notification/pom.xml @@ -19,7 +19,7 @@ apimgt org.wso2.carbon.apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT org.wso2.carbon.apimgt.notification 4.0.0 diff --git a/components/apimgt/org.wso2.carbon.apimgt.output.adapter.http/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.output.adapter.http/pom.xml index b9cf4583e513..274267790456 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.output.adapter.http/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.output.adapter.http/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.persistence/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.persistence/pom.xml index ed8878ebbd61..448ff0332ff2 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.persistence/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.persistence/pom.xml @@ -3,7 +3,7 @@ apimgt org.wso2.carbon.apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml 4.0.0 diff --git a/components/apimgt/org.wso2.carbon.apimgt.persistence/src/main/java/org/wso2/carbon/apimgt/persistence/RegistryPersistenceImpl.java b/components/apimgt/org.wso2.carbon.apimgt.persistence/src/main/java/org/wso2/carbon/apimgt/persistence/RegistryPersistenceImpl.java index 592f35637c04..e04e155f5e57 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.persistence/src/main/java/org/wso2/carbon/apimgt/persistence/RegistryPersistenceImpl.java +++ b/components/apimgt/org.wso2.carbon.apimgt.persistence/src/main/java/org/wso2/carbon/apimgt/persistence/RegistryPersistenceImpl.java @@ -350,6 +350,8 @@ public void restoreAPIRevision(Organization org, String apiUUID, String revision GenericArtifact apiArtifact = artifactManager.getGenericArtifact(apiUUID); String lcState = ((GenericArtifactImpl) apiArtifact).getLcState(); if (apiArtifact != null) { + String existingVersionComparable = apiArtifact.getAttribute(APIConstants + .API_OVERVIEW_VERSION_COMPARABLE); API api = RegistryPersistenceUtil.getApiForPublishing(registry, apiArtifact); String visibleRolesList = api.getVisibleRoles(); String[] visibleRoles = new String[0]; @@ -370,6 +372,16 @@ public void restoreAPIRevision(Organization org, String apiUUID, String revision ((UserRegistry) registry).getTenantId()); RegistryPersistenceUtil.setResourcePermissions(api.getId().getProviderName(), api.getVisibility(), visibleRoles, apiPath); + GenericArtifact newArtifact = artifactManager.getGenericArtifact(apiUUID); + if (newArtifact != null && newArtifact.getAttribute(APIConstants.API_OVERVIEW_VERSION_COMPARABLE) == null) { + if (existingVersionComparable != null) { + newArtifact.setAttribute(APIConstants.API_OVERVIEW_VERSION_COMPARABLE, existingVersionComparable); + } else { + newArtifact.setAttribute(APIConstants.API_OVERVIEW_VERSION_COMPARABLE, + String.valueOf(System.currentTimeMillis())); + } + artifactManager.updateGenericArtifact(newArtifact); + } } registry.commitTransaction(); transactionCommitted = true; diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/pom.xml index 59b1213cb13e..189c8424f648 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/dto/VHostDTO.java b/components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/dto/VHostDTO.java index cc50419e5792..92dbe48d892b 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/dto/VHostDTO.java +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/dto/VHostDTO.java @@ -25,7 +25,9 @@ public class VHostDTO { private Integer httpPort = null; private Integer httpsPort = null; private Integer wsPort = null; + private String wsHost = null; private Integer wssPort = null; + private String wssHost = null; /** **/ @@ -113,6 +115,23 @@ public void setWsPort(Integer wsPort) { this.wsPort = wsPort; } + /** + **/ + public VHostDTO wsHost(String wsHost) { + this.wsHost = wsHost; + return this; + } + + + @ApiModelProperty(example = "mg.wso2.com", value = "") + @JsonProperty("wsHost") + public String getWsHost() { + return wsHost; + } + public void setWsHost(String wsHost) { + this.wsHost = wsHost; + } + /** **/ public VHostDTO wssPort(Integer wssPort) { @@ -130,6 +149,23 @@ public void setWssPort(Integer wssPort) { this.wssPort = wssPort; } + /** + **/ + public VHostDTO wssHost(String wssHost) { + this.wssHost = wssHost; + return this; + } + + + @ApiModelProperty(example = "mg.wso2.com", value = "") + @JsonProperty("wssHost") + public String getWssHost() { + return wssHost; + } + public void setWssHost(String wssHost) { + this.wssHost = wssHost; + } + @Override public boolean equals(java.lang.Object o) { @@ -145,12 +181,14 @@ public boolean equals(java.lang.Object o) { Objects.equals(httpPort, vhost.httpPort) && Objects.equals(httpsPort, vhost.httpsPort) && Objects.equals(wsPort, vhost.wsPort) && - Objects.equals(wssPort, vhost.wssPort); + Objects.equals(wsHost, vhost.wsHost) && + Objects.equals(wssPort, vhost.wssPort) && + Objects.equals(wssHost, vhost.wssHost); } @Override public int hashCode() { - return Objects.hash(host, httpContext, httpPort, httpsPort, wsPort, wssPort); + return Objects.hash(host, httpContext, httpPort, httpsPort, wsPort, wsHost, wssPort, wssHost); } @Override @@ -163,7 +201,9 @@ public String toString() { sb.append(" httpPort: ").append(toIndentedString(httpPort)).append("\n"); sb.append(" httpsPort: ").append(toIndentedString(httpsPort)).append("\n"); sb.append(" wsPort: ").append(toIndentedString(wsPort)).append("\n"); + sb.append(" wsHost: ").append(toIndentedString(wsHost)).append("\n"); sb.append(" wssPort: ").append(toIndentedString(wssPort)).append("\n"); + sb.append(" wssHost: ").append(toIndentedString(wssHost)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/utils/mappings/EnvironmentMappingUtil.java b/components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/utils/mappings/EnvironmentMappingUtil.java index ffb200398bf3..abad3585c062 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/utils/mappings/EnvironmentMappingUtil.java +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/utils/mappings/EnvironmentMappingUtil.java @@ -152,6 +152,16 @@ public static VHost fromVHostDtoToVHost(VHostDTO vhostDTO) { vhost.setHttpsPort(vhostDTO.getHttpsPort()); vhost.setWsPort(vhostDTO.getWsPort()); vhost.setWssPort(vhostDTO.getWssPort()); + if (vhostDTO.getWsHost() == null) { + vhost.setWsHost(vhostDTO.getHost()); + } else { + vhost.setWsHost(vhostDTO.getWsHost()); + } + if (vhostDTO.getWssHost() == null) { + vhost.setWssHost(vhostDTO.getHost()); + } else { + vhost.setWssHost(vhostDTO.getWssHost()); + } return vhost; } diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml b/components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml index 0bf90b7383ad..a3cffc42f5c1 100755 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml @@ -4084,9 +4084,15 @@ components: wsPort: type: integer example: 9099 + wsHost: + type: string + example: mg.wso2.com wssPort: type: integer example: 8099 + wssHost: + type: string + example: mg.wso2.com AdditionalProperty: title: Additional Gateway Properties type: object diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.common/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.rest.api.common/pom.xml index f1f588a4bc5f..cb26c326016d 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.common/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.common/pom.xml @@ -17,7 +17,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.dcr/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.rest.api.dcr/pom.xml index f78ab61b226b..4c61e874964c 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.dcr/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.dcr/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.devops/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.rest.api.devops/pom.xml index d0da886c24b8..2c05175b7188 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.devops/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.devops/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.gateway/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.rest.api.gateway/pom.xml index 80d57cce01b0..30a16d3dcb6b 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.gateway/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.gateway/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/pom.xml index 39c15edf2f20..15c735861ac6 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/dto/APIDTO.java b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/dto/APIDTO.java index ab0878f64db6..84a599426891 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/dto/APIDTO.java +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/dto/APIDTO.java @@ -268,6 +268,7 @@ public static AccessControlEnum fromValue(String v) { private WebsubSubscriptionConfigurationDTO websubSubscriptionConfiguration = null; private String workflowStatus = null; private String createdTime = null; + private String lastUpdatedTimestamp = null; @Scope(name = "apim:api_publish", description="", value ="") @Scope(name = "apim:api_manage", description="", value ="") private String lastUpdatedTime = null; @@ -1075,6 +1076,23 @@ public void setCreatedTime(String createdTime) { this.createdTime = createdTime; } + /** + **/ + public APIDTO lastUpdatedTimestamp(String lastUpdatedTimestamp) { + this.lastUpdatedTimestamp = lastUpdatedTimestamp; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("lastUpdatedTimestamp") + public String getLastUpdatedTimestamp() { + return lastUpdatedTimestamp; + } + public void setLastUpdatedTimestamp(String lastUpdatedTimestamp) { + this.lastUpdatedTimestamp = lastUpdatedTimestamp; + } + /** **/ public APIDTO lastUpdatedTime(String lastUpdatedTime) { @@ -1361,6 +1379,7 @@ public boolean equals(java.lang.Object o) { Objects.equals(websubSubscriptionConfiguration, API.websubSubscriptionConfiguration) && Objects.equals(workflowStatus, API.workflowStatus) && Objects.equals(createdTime, API.createdTime) && + Objects.equals(lastUpdatedTimestamp, API.lastUpdatedTimestamp) && Objects.equals(lastUpdatedTime, API.lastUpdatedTime) && Objects.equals(endpointConfig, API.endpointConfig) && Objects.equals(endpointImplementationType, API.endpointImplementationType) && @@ -1378,7 +1397,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash(id, name, description, context, version, provider, lifeCycleStatus, wsdlInfo, wsdlUrl, responseCachingEnabled, cacheTimeout, hasThumbnail, isDefaultVersion, isRevision, revisionedApiId, revisionId, enableSchemaValidation, enableSubscriberVerification, type, audience, transport, tags, policies, apiThrottlingPolicy, authorizationHeader, securityScheme, maxTps, visibility, visibleRoles, visibleTenants, mediationPolicies, subscriptionAvailability, subscriptionAvailableTenants, additionalProperties, additionalPropertiesMap, monetization, accessControl, accessControlRoles, businessInformation, corsConfiguration, websubSubscriptionConfiguration, workflowStatus, createdTime, lastUpdatedTime, endpointConfig, endpointImplementationType, scopes, operations, threatProtectionPolicies, categories, keyManagers, serviceInfo, advertiseInfo, gatewayVendor, gatewayType, asyncTransportProtocols); + return Objects.hash(id, name, description, context, version, provider, lifeCycleStatus, wsdlInfo, wsdlUrl, responseCachingEnabled, cacheTimeout, hasThumbnail, isDefaultVersion, isRevision, revisionedApiId, revisionId, enableSchemaValidation, enableSubscriberVerification, type, audience, transport, tags, policies, apiThrottlingPolicy, authorizationHeader, securityScheme, maxTps, visibility, visibleRoles, visibleTenants, mediationPolicies, subscriptionAvailability, subscriptionAvailableTenants, additionalProperties, additionalPropertiesMap, monetization, accessControl, accessControlRoles, businessInformation, corsConfiguration, websubSubscriptionConfiguration, workflowStatus, createdTime, lastUpdatedTimestamp, lastUpdatedTime, endpointConfig, endpointImplementationType, scopes, operations, threatProtectionPolicies, categories, keyManagers, serviceInfo, advertiseInfo, gatewayVendor, gatewayType, asyncTransportProtocols); } @Override @@ -1429,6 +1448,7 @@ public String toString() { sb.append(" websubSubscriptionConfiguration: ").append(toIndentedString(websubSubscriptionConfiguration)).append("\n"); sb.append(" workflowStatus: ").append(toIndentedString(workflowStatus)).append("\n"); sb.append(" createdTime: ").append(toIndentedString(createdTime)).append("\n"); + sb.append(" lastUpdatedTimestamp: ").append(toIndentedString(lastUpdatedTimestamp)).append("\n"); sb.append(" lastUpdatedTime: ").append(toIndentedString(lastUpdatedTime)).append("\n"); sb.append(" endpointConfig: ").append(toIndentedString(endpointConfig)).append("\n"); sb.append(" endpointImplementationType: ").append(toIndentedString(endpointImplementationType)).append("\n"); diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/dto/APIProductDTO.java b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/dto/APIProductDTO.java index 7aa29096df7b..ed184c00bd84 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/dto/APIProductDTO.java +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/dto/APIProductDTO.java @@ -193,6 +193,7 @@ public static SubscriptionAvailabilityEnum fromValue(String v) { private APICorsConfigurationDTO corsConfiguration = null; private String createdTime = null; private String lastUpdatedTime = null; + private String lastUpdatedTimestamp = null; private String gatewayVendor = null; private List apis = new ArrayList(); private List scopes = new ArrayList(); @@ -800,6 +801,23 @@ public void setLastUpdatedTime(String lastUpdatedTime) { this.lastUpdatedTime = lastUpdatedTime; } + /** + **/ + public APIProductDTO lastUpdatedTimestamp(String lastUpdatedTimestamp) { + this.lastUpdatedTimestamp = lastUpdatedTimestamp; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("lastUpdatedTimestamp") + public String getLastUpdatedTimestamp() { + return lastUpdatedTimestamp; + } + public void setLastUpdatedTimestamp(String lastUpdatedTimestamp) { + this.lastUpdatedTimestamp = lastUpdatedTimestamp; + } + /** **/ public APIProductDTO gatewayVendor(String gatewayVendor) { @@ -933,6 +951,7 @@ public boolean equals(java.lang.Object o) { Objects.equals(corsConfiguration, apIProduct.corsConfiguration) && Objects.equals(createdTime, apIProduct.createdTime) && Objects.equals(lastUpdatedTime, apIProduct.lastUpdatedTime) && + Objects.equals(lastUpdatedTimestamp, apIProduct.lastUpdatedTimestamp) && Objects.equals(gatewayVendor, apIProduct.gatewayVendor) && Objects.equals(apis, apIProduct.apis) && Objects.equals(scopes, apIProduct.scopes) && @@ -942,7 +961,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash(id, name, context, description, provider, hasThumbnail, state, enableSchemaValidation, isRevision, revisionedApiProductId, revisionId, responseCachingEnabled, cacheTimeout, visibility, visibleRoles, visibleTenants, accessControl, accessControlRoles, apiType, transport, tags, policies, apiThrottlingPolicy, authorizationHeader, securityScheme, subscriptionAvailability, subscriptionAvailableTenants, additionalProperties, additionalPropertiesMap, monetization, businessInformation, corsConfiguration, createdTime, lastUpdatedTime, gatewayVendor, apis, scopes, categories, workflowStatus); + return Objects.hash(id, name, context, description, provider, hasThumbnail, state, enableSchemaValidation, isRevision, revisionedApiProductId, revisionId, responseCachingEnabled, cacheTimeout, visibility, visibleRoles, visibleTenants, accessControl, accessControlRoles, apiType, transport, tags, policies, apiThrottlingPolicy, authorizationHeader, securityScheme, subscriptionAvailability, subscriptionAvailableTenants, additionalProperties, additionalPropertiesMap, monetization, businessInformation, corsConfiguration, createdTime, lastUpdatedTime, lastUpdatedTimestamp, gatewayVendor, apis, scopes, categories, workflowStatus); } @Override @@ -984,6 +1003,7 @@ public String toString() { sb.append(" corsConfiguration: ").append(toIndentedString(corsConfiguration)).append("\n"); sb.append(" createdTime: ").append(toIndentedString(createdTime)).append("\n"); sb.append(" lastUpdatedTime: ").append(toIndentedString(lastUpdatedTime)).append("\n"); + sb.append(" lastUpdatedTimestamp: ").append(toIndentedString(lastUpdatedTimestamp)).append("\n"); sb.append(" gatewayVendor: ").append(toIndentedString(gatewayVendor)).append("\n"); sb.append(" apis: ").append(toIndentedString(apis)).append("\n"); sb.append(" scopes: ").append(toIndentedString(scopes)).append("\n"); diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/dto/VHostDTO.java b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/dto/VHostDTO.java index 0848b55e549d..a4ab1d9d7750 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/dto/VHostDTO.java +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/dto/VHostDTO.java @@ -25,7 +25,9 @@ public class VHostDTO { private Integer httpPort = null; private Integer httpsPort = null; private Integer wsPort = null; + private String wsHost = null; private Integer wssPort = null; + private String wssHost = null; private Integer websubHttpPort = null; private Integer websubHttpsPort = null; @@ -114,6 +116,23 @@ public void setWsPort(Integer wsPort) { this.wsPort = wsPort; } + /** + **/ + public VHostDTO wsHost(String wsHost) { + this.wsHost = wsHost; + return this; + } + + + @ApiModelProperty(example = "mg.wso2.com", value = "") + @JsonProperty("wsHost") + public String getWsHost() { + return wsHost; + } + public void setWsHost(String wsHost) { + this.wsHost = wsHost; + } + /** **/ public VHostDTO wssPort(Integer wssPort) { @@ -131,6 +150,23 @@ public void setWssPort(Integer wssPort) { this.wssPort = wssPort; } + /** + **/ + public VHostDTO wssHost(String wssHost) { + this.wssHost = wssHost; + return this; + } + + + @ApiModelProperty(example = "mg.wso2.com", value = "") + @JsonProperty("wssHost") + public String getWssHost() { + return wssHost; + } + public void setWssHost(String wssHost) { + this.wssHost = wssHost; + } + /** **/ public VHostDTO websubHttpPort(Integer websubHttpPort) { @@ -180,14 +216,16 @@ public boolean equals(java.lang.Object o) { Objects.equals(httpPort, vhost.httpPort) && Objects.equals(httpsPort, vhost.httpsPort) && Objects.equals(wsPort, vhost.wsPort) && + Objects.equals(wsHost, vhost.wsHost) && Objects.equals(wssPort, vhost.wssPort) && + Objects.equals(wssHost, vhost.wssHost) && Objects.equals(websubHttpPort, vhost.websubHttpPort) && Objects.equals(websubHttpsPort, vhost.websubHttpsPort); } @Override public int hashCode() { - return Objects.hash(host, httpContext, httpPort, httpsPort, wsPort, wssPort, websubHttpPort, websubHttpsPort); + return Objects.hash(host, httpContext, httpPort, httpsPort, wsPort, wsHost, wssPort, wssHost, websubHttpPort, websubHttpsPort); } @Override @@ -200,7 +238,9 @@ public String toString() { sb.append(" httpPort: ").append(toIndentedString(httpPort)).append("\n"); sb.append(" httpsPort: ").append(toIndentedString(httpsPort)).append("\n"); sb.append(" wsPort: ").append(toIndentedString(wsPort)).append("\n"); + sb.append(" wsHost: ").append(toIndentedString(wsHost)).append("\n"); sb.append(" wssPort: ").append(toIndentedString(wssPort)).append("\n"); + sb.append(" wssHost: ").append(toIndentedString(wssHost)).append("\n"); sb.append(" websubHttpPort: ").append(toIndentedString(websubHttpPort)).append("\n"); sb.append(" websubHttpsPort: ").append(toIndentedString(websubHttpsPort)).append("\n"); sb.append("}"); diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/APIControllerUtil.java b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/APIControllerUtil.java index e48374ae3685..5fe30674411f 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/APIControllerUtil.java +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/APIControllerUtil.java @@ -655,6 +655,7 @@ private static JsonObject handleRestEndpoints(String routingPolicy, JsonObject e //get load balanced configs from params JsonElement loadBalancedConfigElement = envParams.get(ImportExportConstants.LOAD_BALANCE_ENDPOINTS_FIELD); + JsonElement failOverConfigElement = envParams.get(ImportExportConstants.FAILOVER_TYPE_ENDPOINT); JsonObject loadBalancedConfigs; if (loadBalancedConfigElement == null) { throw new APIManagementException( @@ -663,6 +664,10 @@ private static JsonObject handleRestEndpoints(String routingPolicy, JsonObject e } else { loadBalancedConfigs = loadBalancedConfigElement.getAsJsonObject(); } + if (failOverConfigElement != null) { + updatedRESTEndpointParams.addProperty(ImportExportConstants.FAILOVER_TYPE_ENDPOINT, + failOverConfigElement.getAsBoolean()); + } updatedRESTEndpointParams.addProperty(ImportExportConstants.ENDPOINT_TYPE_PROPERTY, ImportExportConstants.LOAD_BALANCE_TYPE_ENDPOINT); updatedRESTEndpointParams.addProperty(ImportExportConstants.LOAD_BALANCE_ALGORITHM_CLASS_PROPERTY, diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/APIMappingUtil.java b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/APIMappingUtil.java index b5bf72cefb18..4272e0896e1d 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/APIMappingUtil.java +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/APIMappingUtil.java @@ -1339,6 +1339,7 @@ public static APIDTO fromAPItoDTO(API model, boolean preserveCredentials, Date lastUpdateDate = model.getLastUpdated(); Timestamp timeStamp = new Timestamp(lastUpdateDate.getTime()); dto.setLastUpdatedTime(String.valueOf(timeStamp)); + dto.setLastUpdatedTimestamp(String.valueOf(timeStamp.getTime())); } if (null != model.getCreatedTime()) { Date created = new Date(Long.parseLong(model.getCreatedTime())); @@ -2453,6 +2454,7 @@ public static APIProductDTO fromAPIProducttoDTO(APIProduct product) throws APIMa Date lastUpdateDate = product.getLastUpdated(); Timestamp timeStamp = new Timestamp(lastUpdateDate.getTime()); productDto.setLastUpdatedTime(String.valueOf(timeStamp)); + productDto.setLastUpdatedTimestamp(String.valueOf(timeStamp.getTime())); } if (null != product.getCreatedTime()) { Date createdTime = product.getCreatedTime(); diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/EnvironmentMappingUtil.java b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/EnvironmentMappingUtil.java index 687e80b3e122..dfad946632e9 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/EnvironmentMappingUtil.java +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/EnvironmentMappingUtil.java @@ -117,7 +117,9 @@ public static VHostDTO fromVHostToVHostDTO(VHost vHost) { vHostDTO.setHttpPort(vHost.getHttpPort()); vHostDTO.setHttpsPort(vHost.getHttpsPort()); vHostDTO.setWsPort(vHost.getWsPort()); + vHostDTO.setWsHost(vHost.getWsHost()); vHostDTO.setWssPort(vHost.getWssPort()); + vHostDTO.setWssHost(vHost.getWssHost()); vHostDTO.setWebsubHttpPort(vHost.getWebsubHttpPort()); vHostDTO.setWebsubHttpsPort(vHost.getWebsubHttpsPort()); return vHostDTO; diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/pom.xml index 27a445e5e030..35e4c9704f46 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/impl/ApiProductsApiServiceImpl.java b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/impl/ApiProductsApiServiceImpl.java index 4ca18693fd77..864b5b772433 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/impl/ApiProductsApiServiceImpl.java +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/impl/ApiProductsApiServiceImpl.java @@ -141,7 +141,7 @@ public Response getAPIProductDocumentContent(String apiProductId, //documentation = apiProvider.getProductDocumentation(documentId, tenantDomain); DocumentationContent docContent = apiProvider.getDocumentationContent(apiProductId, documentId, organization); if (docContent == null) { - RestApiUtil.handleResourceNotFoundError(RestApiConstants.RESOURCE_PRODUCT_DOCUMENTATION, documentId, log); + RestApiUtil.handleResourceNotFoundError(RestApiConstants.RESOURCE_PRODUCT_DOCUMENTATION, documentId); return null; } diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/impl/ApisApiServiceImpl.java b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/impl/ApisApiServiceImpl.java index af91e3f897d6..6d212223957f 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/impl/ApisApiServiceImpl.java +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/impl/ApisApiServiceImpl.java @@ -1243,7 +1243,7 @@ public Response getAPIDocumentContentByDocumentId(String apiId, String documentI DocumentationContent docContent = apiProvider.getDocumentationContent(apiId, documentId, organization); if (docContent == null) { - RestApiUtil.handleResourceNotFoundError(RestApiConstants.RESOURCE_DOCUMENTATION, documentId, log); + RestApiUtil.handleResourceNotFoundError(RestApiConstants.RESOURCE_DOCUMENTATION, documentId); return null; } diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml index 63159c6bbf19..dfc2bb286d65 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml @@ -8837,6 +8837,8 @@ components: example: APPROVED createdTime: type: string + lastUpdatedTimestamp: + type: string lastUpdatedTime: type: string x-otherScopes: @@ -9435,6 +9437,8 @@ components: type: string lastUpdatedTime: type: string + lastUpdatedTimestamp: + type: string gatewayVendor: title: field to identify gateway vendor type: string @@ -10363,9 +10367,15 @@ components: wsPort: type: integer example: 9099 + wsHost: + type: string + example: mg.wso2.com wssPort: type: integer example: 8099 + wssHost: + type: string + example: mg.wso2.com websubHttpPort: type: integer example: 9021 diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.service.catalog/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.rest.api.service.catalog/pom.xml index 2b79483789c8..3352046dffdc 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.service.catalog/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.service.catalog/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.store.v1/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.rest.api.store.v1/pom.xml index 5aa7dff39422..f77e674abf39 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.store.v1/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.store.v1/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.store.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/store/v1/impl/ApisApiServiceImpl.java b/components/apimgt/org.wso2.carbon.apimgt.rest.api.store.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/store/v1/impl/ApisApiServiceImpl.java index 5bc3fd3f78de..1b73b466d5cd 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.store.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/store/v1/impl/ApisApiServiceImpl.java +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.store.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/store/v1/impl/ApisApiServiceImpl.java @@ -504,7 +504,7 @@ public Response apisApiIdDocumentsDocumentIdContentGet(String apiId, String docu DocumentationContent docContent = apiConsumer.getDocumentationContent(apiId, documentId, organization); if (docContent == null) { - RestApiUtil.handleResourceNotFoundError(RestApiConstants.RESOURCE_DOCUMENTATION, documentId, log); + RestApiUtil.handleResourceNotFoundError(RestApiConstants.RESOURCE_DOCUMENTATION, documentId); return null; } diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.util/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.rest.api.util/pom.xml index 39014e960535..82524ea60a60 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.util/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.util/pom.xml @@ -17,7 +17,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.util/src/main/java/org/wso2/carbon/apimgt/rest/api/util/utils/RestApiUtil.java b/components/apimgt/org.wso2.carbon.apimgt.rest.api.util/src/main/java/org/wso2/carbon/apimgt/rest/api/util/utils/RestApiUtil.java index 9b1ca826d033..4ae5500fc92e 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.util/src/main/java/org/wso2/carbon/apimgt/rest/api/util/utils/RestApiUtil.java +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.util/src/main/java/org/wso2/carbon/apimgt/rest/api/util/utils/RestApiUtil.java @@ -779,6 +779,18 @@ public static void handleResourceNotFoundError(String resource, String id, Log l throw notFoundException; } + /** + * Builds a NotFoundException with specified details and throws it + * + * @param resource requested resource + * @param id id of resource + * @throws NotFoundException + */ + public static void handleResourceNotFoundError(String resource, String id) { + NotFoundException notFoundException = buildNotFoundException(resource, id); + throw notFoundException; + } + /** * Logs the error, builds a NotFoundException with specified details and throws it * diff --git a/components/apimgt/org.wso2.carbon.apimgt.solace/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.solace/pom.xml index 0f327a3a7816..2116b5eebcf8 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.solace/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.solace/pom.xml @@ -3,7 +3,7 @@ apimgt org.wso2.carbon.apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.throttle.policy.deployer/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.throttle.policy.deployer/pom.xml index 20abff22586e..f64ef5bdcd5f 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.throttle.policy.deployer/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.throttle.policy.deployer/pom.xml @@ -19,7 +19,7 @@ apimgt org.wso2.carbon.apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT 4.0.0 bundle diff --git a/components/apimgt/org.wso2.carbon.apimgt.throttle.policy.deployer/src/main/java/org/wso2/carbon/apimgt/throttle/policy/deployer/PolicyRetriever.java b/components/apimgt/org.wso2.carbon.apimgt.throttle.policy.deployer/src/main/java/org/wso2/carbon/apimgt/throttle/policy/deployer/PolicyRetriever.java index 53e6603451ce..2c6204ae951a 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.throttle.policy.deployer/src/main/java/org/wso2/carbon/apimgt/throttle/policy/deployer/PolicyRetriever.java +++ b/components/apimgt/org.wso2.carbon.apimgt.throttle.policy.deployer/src/main/java/org/wso2/carbon/apimgt/throttle/policy/deployer/PolicyRetriever.java @@ -237,7 +237,7 @@ private CloseableHttpResponse invokeService(String endpoint, String tenantDomain + new String(credentials, APIConstants.DigestAuthConstants.CHARSET)); HttpClient httpClient = APIUtil.getHttpClient(port, protocol); try { - return APIUtil.executeHTTPRequest(method, httpClient); + return APIUtil.executeHTTPRequestWithRetries(method, httpClient); } catch (APIManagementException e) { throw new ThrottlePolicyDeployerException(e); } diff --git a/components/apimgt/org.wso2.carbon.apimgt.throttling.siddhi.extension/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.throttling.siddhi.extension/pom.xml index 59b7607b7984..2b12d3a07eed 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.throttling.siddhi.extension/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.throttling.siddhi.extension/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.tokenmgt/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.tokenmgt/pom.xml index 5ab13ab70d89..aaf14773073c 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.tokenmgt/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.tokenmgt/pom.xml @@ -16,7 +16,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/org.wso2.carbon.apimgt.tracing/pom.xml b/components/apimgt/org.wso2.carbon.apimgt.tracing/pom.xml index 34c65766e52a..7c3c12b1cb5c 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.tracing/pom.xml +++ b/components/apimgt/org.wso2.carbon.apimgt.tracing/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.apimgt apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/components/apimgt/pom.xml b/components/apimgt/pom.xml index 41d839674e0e..1bbba3130bd8 100644 --- a/components/apimgt/pom.xml +++ b/components/apimgt/pom.xml @@ -19,7 +19,7 @@ org.wso2.carbon.apimgt carbon-apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../../pom.xml diff --git a/components/apimgt/samples/org.wso2.carbon.apimgt.samples.calculator/pom.xml b/components/apimgt/samples/org.wso2.carbon.apimgt.samples.calculator/pom.xml index f17a94b99a52..b5d9400e5720 100644 --- a/components/apimgt/samples/org.wso2.carbon.apimgt.samples.calculator/pom.xml +++ b/components/apimgt/samples/org.wso2.carbon.apimgt.samples.calculator/pom.xml @@ -19,7 +19,7 @@ apimgt org.wso2.carbon.apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../../pom.xml diff --git a/components/apimgt/samples/org.wso2.carbon.apimgt.samples.pizzashack/pom.xml b/components/apimgt/samples/org.wso2.carbon.apimgt.samples.pizzashack/pom.xml index 66d9f750b53d..92ba9f346f20 100644 --- a/components/apimgt/samples/org.wso2.carbon.apimgt.samples.pizzashack/pom.xml +++ b/components/apimgt/samples/org.wso2.carbon.apimgt.samples.pizzashack/pom.xml @@ -20,7 +20,7 @@ apimgt org.wso2.carbon.apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../../pom.xml diff --git a/features/apimgt/org.wso2.carbon.apimgt.cache.invalidation.feature/pom.xml b/features/apimgt/org.wso2.carbon.apimgt.cache.invalidation.feature/pom.xml index dcc668f28fd5..c3d0d3bf7aa4 100644 --- a/features/apimgt/org.wso2.carbon.apimgt.cache.invalidation.feature/pom.xml +++ b/features/apimgt/org.wso2.carbon.apimgt.cache.invalidation.feature/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.apimgt apimgt-feature - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/features/apimgt/org.wso2.carbon.apimgt.core.feature/pom.xml b/features/apimgt/org.wso2.carbon.apimgt.core.feature/pom.xml index 193c906240e5..4e6f884f5091 100644 --- a/features/apimgt/org.wso2.carbon.apimgt.core.feature/pom.xml +++ b/features/apimgt/org.wso2.carbon.apimgt.core.feature/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.apimgt apimgt-feature - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/features/apimgt/org.wso2.carbon.apimgt.eventing.feature/pom.xml b/features/apimgt/org.wso2.carbon.apimgt.eventing.feature/pom.xml index c82130e361bb..5cbdcd0cbd42 100644 --- a/features/apimgt/org.wso2.carbon.apimgt.eventing.feature/pom.xml +++ b/features/apimgt/org.wso2.carbon.apimgt.eventing.feature/pom.xml @@ -20,7 +20,7 @@ apimgt-feature org.wso2.carbon.apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/features/apimgt/org.wso2.carbon.apimgt.eventing.hub.feature/pom.xml b/features/apimgt/org.wso2.carbon.apimgt.eventing.hub.feature/pom.xml index 847d4376015a..8e6c9676cfe1 100644 --- a/features/apimgt/org.wso2.carbon.apimgt.eventing.hub.feature/pom.xml +++ b/features/apimgt/org.wso2.carbon.apimgt.eventing.hub.feature/pom.xml @@ -20,7 +20,7 @@ apimgt-feature org.wso2.carbon.apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/features/apimgt/org.wso2.carbon.apimgt.feature/pom.xml b/features/apimgt/org.wso2.carbon.apimgt.feature/pom.xml index 4ffb0f679410..e6f28cad0ab0 100644 --- a/features/apimgt/org.wso2.carbon.apimgt.feature/pom.xml +++ b/features/apimgt/org.wso2.carbon.apimgt.feature/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.apimgt apimgt-feature - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/features/apimgt/org.wso2.carbon.apimgt.gateway.feature/pom.xml b/features/apimgt/org.wso2.carbon.apimgt.gateway.feature/pom.xml index 2750e9144628..0d6b7ddb9fb0 100644 --- a/features/apimgt/org.wso2.carbon.apimgt.gateway.feature/pom.xml +++ b/features/apimgt/org.wso2.carbon.apimgt.gateway.feature/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.apimgt apimgt-feature - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/features/apimgt/org.wso2.carbon.apimgt.internal.service.feature/pom.xml b/features/apimgt/org.wso2.carbon.apimgt.internal.service.feature/pom.xml index a47b5f6acef2..30058b8b9f5a 100644 --- a/features/apimgt/org.wso2.carbon.apimgt.internal.service.feature/pom.xml +++ b/features/apimgt/org.wso2.carbon.apimgt.internal.service.feature/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.apimgt apimgt-feature - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/features/apimgt/org.wso2.carbon.apimgt.jms.listener.feature/pom.xml b/features/apimgt/org.wso2.carbon.apimgt.jms.listener.feature/pom.xml index 67d3772c6f27..330695d71c87 100644 --- a/features/apimgt/org.wso2.carbon.apimgt.jms.listener.feature/pom.xml +++ b/features/apimgt/org.wso2.carbon.apimgt.jms.listener.feature/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.apimgt apimgt-feature - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/features/apimgt/org.wso2.carbon.apimgt.keymanager.feature/pom.xml b/features/apimgt/org.wso2.carbon.apimgt.keymanager.feature/pom.xml index 24d6b5933517..c93f0e34c624 100644 --- a/features/apimgt/org.wso2.carbon.apimgt.keymanager.feature/pom.xml +++ b/features/apimgt/org.wso2.carbon.apimgt.keymanager.feature/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.apimgt apimgt-feature - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/features/apimgt/org.wso2.carbon.apimgt.persistence.feature/pom.xml b/features/apimgt/org.wso2.carbon.apimgt.persistence.feature/pom.xml index d99b9dcdbe85..434494280a3f 100644 --- a/features/apimgt/org.wso2.carbon.apimgt.persistence.feature/pom.xml +++ b/features/apimgt/org.wso2.carbon.apimgt.persistence.feature/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.apimgt apimgt-feature - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/features/apimgt/org.wso2.carbon.apimgt.rest.api.admin.feature/pom.xml b/features/apimgt/org.wso2.carbon.apimgt.rest.api.admin.feature/pom.xml index b38810155516..6aa3262b5dd4 100644 --- a/features/apimgt/org.wso2.carbon.apimgt.rest.api.admin.feature/pom.xml +++ b/features/apimgt/org.wso2.carbon.apimgt.rest.api.admin.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.apimgt apimgt-feature - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/features/apimgt/org.wso2.carbon.apimgt.rest.api.dcr.feature/pom.xml b/features/apimgt/org.wso2.carbon.apimgt.rest.api.dcr.feature/pom.xml index c39e1b80116e..62bd7e59de4d 100644 --- a/features/apimgt/org.wso2.carbon.apimgt.rest.api.dcr.feature/pom.xml +++ b/features/apimgt/org.wso2.carbon.apimgt.rest.api.dcr.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.apimgt apimgt-feature - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/features/apimgt/org.wso2.carbon.apimgt.rest.api.devops.feature/pom.xml b/features/apimgt/org.wso2.carbon.apimgt.rest.api.devops.feature/pom.xml index 1c9926610a53..93b3d76565a6 100644 --- a/features/apimgt/org.wso2.carbon.apimgt.rest.api.devops.feature/pom.xml +++ b/features/apimgt/org.wso2.carbon.apimgt.rest.api.devops.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.apimgt apimgt-feature - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/features/apimgt/org.wso2.carbon.apimgt.rest.api.gateway.feature/pom.xml b/features/apimgt/org.wso2.carbon.apimgt.rest.api.gateway.feature/pom.xml index fafd395772b2..ed65266489a4 100644 --- a/features/apimgt/org.wso2.carbon.apimgt.rest.api.gateway.feature/pom.xml +++ b/features/apimgt/org.wso2.carbon.apimgt.rest.api.gateway.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.apimgt apimgt-feature - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/features/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.feature/pom.xml b/features/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.feature/pom.xml index fba85bc4bbc9..028e475ef549 100644 --- a/features/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.feature/pom.xml +++ b/features/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.apimgt apimgt-feature - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/features/apimgt/org.wso2.carbon.apimgt.rest.api.service.catalog.feature/pom.xml b/features/apimgt/org.wso2.carbon.apimgt.rest.api.service.catalog.feature/pom.xml index 02f3d01c21a4..9be9df8222e2 100644 --- a/features/apimgt/org.wso2.carbon.apimgt.rest.api.service.catalog.feature/pom.xml +++ b/features/apimgt/org.wso2.carbon.apimgt.rest.api.service.catalog.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.apimgt apimgt-feature - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/features/apimgt/org.wso2.carbon.apimgt.rest.api.store.feature/pom.xml b/features/apimgt/org.wso2.carbon.apimgt.rest.api.store.feature/pom.xml index 3d8882a2e94d..0ed8ec1f23e6 100644 --- a/features/apimgt/org.wso2.carbon.apimgt.rest.api.store.feature/pom.xml +++ b/features/apimgt/org.wso2.carbon.apimgt.rest.api.store.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.apimgt apimgt-feature - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/features/apimgt/org.wso2.carbon.apimgt.scxml.feature/pom.xml b/features/apimgt/org.wso2.carbon.apimgt.scxml.feature/pom.xml index 8dfa32cb0479..6d8443c114f2 100644 --- a/features/apimgt/org.wso2.carbon.apimgt.scxml.feature/pom.xml +++ b/features/apimgt/org.wso2.carbon.apimgt.scxml.feature/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.apimgt apimgt-feature - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/features/apimgt/org.wso2.carbon.apimgt.throttle.policy.deployer.feature/pom.xml b/features/apimgt/org.wso2.carbon.apimgt.throttle.policy.deployer.feature/pom.xml index 654a16069572..7f2c4cecd4e3 100644 --- a/features/apimgt/org.wso2.carbon.apimgt.throttle.policy.deployer.feature/pom.xml +++ b/features/apimgt/org.wso2.carbon.apimgt.throttle.policy.deployer.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.apimgt apimgt-feature - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/features/apimgt/org.wso2.carbon.apimgt.throttling.siddhi.extension.feature/pom.xml b/features/apimgt/org.wso2.carbon.apimgt.throttling.siddhi.extension.feature/pom.xml index 6276ff7fa5a4..51da913db4d4 100644 --- a/features/apimgt/org.wso2.carbon.apimgt.throttling.siddhi.extension.feature/pom.xml +++ b/features/apimgt/org.wso2.carbon.apimgt.throttling.siddhi.extension.feature/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.apimgt apimgt-feature - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/features/apimgt/org.wso2.carbon.apimgt.tokenmgt.feature/pom.xml b/features/apimgt/org.wso2.carbon.apimgt.tokenmgt.feature/pom.xml index 5c07a723fde8..eb23fbb16da7 100644 --- a/features/apimgt/org.wso2.carbon.apimgt.tokenmgt.feature/pom.xml +++ b/features/apimgt/org.wso2.carbon.apimgt.tokenmgt.feature/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.apimgt apimgt-feature - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/features/apimgt/org.wso2.carbon.apimgt.tracing.feature/pom.xml b/features/apimgt/org.wso2.carbon.apimgt.tracing.feature/pom.xml index cdc19befb96e..de7b420672df 100644 --- a/features/apimgt/org.wso2.carbon.apimgt.tracing.feature/pom.xml +++ b/features/apimgt/org.wso2.carbon.apimgt.tracing.feature/pom.xml @@ -21,7 +21,7 @@ apimgt-feature org.wso2.carbon.apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT 4.0.0 diff --git a/features/apimgt/pom.xml b/features/apimgt/pom.xml index 1ee78265991c..33dd7da60415 100644 --- a/features/apimgt/pom.xml +++ b/features/apimgt/pom.xml @@ -19,7 +19,7 @@ org.wso2.carbon.apimgt carbon-apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../../pom.xml diff --git a/pom.xml b/pom.xml index 497fff98d1ad..afc4cbc10d83 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.wso2.carbon.apimgt carbon-apimgt pom - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT WSO2 Carbon - API Management Aggregator POM https://wso2.org @@ -1966,7 +1966,7 @@ 1.3 - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT [9.0.0, 10.0.0) 5.3.5 @@ -2092,7 +2092,7 @@ 4.5.10 1.14 7.9.0.wso2v1 - 2.3 + 2.4.11 2.3 1.7.0 1.7.29 @@ -2188,7 +2188,7 @@ 3.0.0.wso2v1 1.9.4 1.1.3 - 2.6.0.wso2v1 + 2.6.0.wso2v2 1.6.wso2v1 2.6.0.wso2v1 1.2.4 diff --git a/service-stubs/apimgt/org.wso2.carbon.apimgt.keymgt.stub/pom.xml b/service-stubs/apimgt/org.wso2.carbon.apimgt.keymgt.stub/pom.xml index e77fe38e8086..f6a724d94863 100644 --- a/service-stubs/apimgt/org.wso2.carbon.apimgt.keymgt.stub/pom.xml +++ b/service-stubs/apimgt/org.wso2.carbon.apimgt.keymgt.stub/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.apimgt apimgt-stubs - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../pom.xml diff --git a/service-stubs/apimgt/pom.xml b/service-stubs/apimgt/pom.xml index 7761701cb96b..475ca1190efd 100644 --- a/service-stubs/apimgt/pom.xml +++ b/service-stubs/apimgt/pom.xml @@ -19,7 +19,7 @@ org.wso2.carbon.apimgt carbon-apimgt - 9.28.152-SNAPSHOT + 9.28.154-SNAPSHOT ../../pom.xml