diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIConfig.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIConfig.java index ca020bd83a6..0c2334ae20f 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIConfig.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIConfig.java @@ -57,6 +57,7 @@ public class APIConfig { private String tenantDomain; private String[] tags; private Set scopes; + private boolean isDefault = true; @XmlElement(name = "Policy", required = true) public String getPolicy() { @@ -184,4 +185,13 @@ public class APIConfig { public void setScopes(Set scopes) { this.scopes = scopes; } + + @XmlElement(name = "isDefault") + public boolean isDefault() { + return isDefault; + } + + public void setDefault(boolean aDefault) { + isDefault = aDefault; + } } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java index bc02e33e5a7..4bb54d5ac15 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java @@ -108,7 +108,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { api.setStatus(PUBLISHED_STATUS); api.setResponseCaching("DISABLED"); api.setDestinationStatsEnabled("false"); - api.isDefaultVersion(true); + api.isDefaultVersion(config.isDefault()); List transport = new ArrayList<>(); transport.add("https"); transport.add("http"); diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java index e1f21952828..cbb27d9f2af 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java @@ -55,6 +55,7 @@ public class APIPublisherUtil { private static final String NON_SECURED_RESOURCES = "nonSecuredEndPoints"; private static final String AUTH_TYPE_NON_SECURED = "None"; + private static final String PARAM_IS_DEFAULT = "isDefault"; public static String getServerBaseUrl() { WebappPublisherConfig webappPublisherConfig = WebappPublisherConfig.getInstance(); @@ -143,6 +144,13 @@ public class APIPublisherUtil { apiConfig.setSecured(false); + boolean isDefault = true; + String isDefaultParam = servletContext.getInitParameter(PARAM_IS_DEFAULT); + if (isDefaultParam != null && !isDefaultParam.isEmpty()) { + isDefault = Boolean.parseBoolean(isDefaultParam); + } + apiConfig.setDefault(isDefault); + String transports = servletContext.getInitParameter(PARAM_MANAGED_API_TRANSPORTS); if (transports == null || transports.isEmpty()) { if (log.isDebugEnabled()) { diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/webapp/WEB-INF/web.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/webapp/WEB-INF/web.xml index ca08169c8c5..e919cb9235b 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/webapp/WEB-INF/web.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/webapp/WEB-INF/web.xml @@ -44,6 +44,10 @@ doAuthentication true + + isDefault + false + diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/webapp/WEB-INF/web.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/webapp/WEB-INF/web.xml index 6fd45f33b32..6cef7eee36f 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/webapp/WEB-INF/web.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/webapp/WEB-INF/web.xml @@ -37,6 +37,10 @@ doAuthentication true + + isDefault + false + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.v09.api/src/main/webapp/WEB-INF/web.xml b/components/device-mgt/org.wso2.carbon.device.mgt.v09.api/src/main/webapp/WEB-INF/web.xml index b23f60be4cc..bc6b3d89070 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.v09.api/src/main/webapp/WEB-INF/web.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.v09.api/src/main/webapp/WEB-INF/web.xml @@ -44,6 +44,10 @@ doAuthentication true + + isDefault + false +