default API set to newly added API and fixed it by using context parameters

revert-70aa11f8
lasantha 7 years ago
parent 0aa0401d98
commit 11310a9145

@ -57,6 +57,7 @@ public class APIConfig {
private String tenantDomain;
private String[] tags;
private Set<ApiScope> scopes;
private boolean isDefault = true;
@XmlElement(name = "Policy", required = true)
public String getPolicy() {
@ -184,4 +185,13 @@ public class APIConfig {
public void setScopes(Set<ApiScope> scopes) {
this.scopes = scopes;
}
@XmlElement(name = "isDefault")
public boolean isDefault() {
return isDefault;
}
public void setDefault(boolean aDefault) {
isDefault = aDefault;
}
}

@ -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<String> transport = new ArrayList<>();
transport.add("https");
transport.add("http");

@ -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()) {

@ -44,6 +44,10 @@
<param-name>doAuthentication</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>isDefault</param-name>
<param-value>false</param-value>
</context-param>
<!--publish to apim-->
<context-param>

@ -37,6 +37,10 @@
<param-name>doAuthentication</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>isDefault</param-name>
<param-value>false</param-value>
</context-param>
<!--publish to apim-->
<context-param>

@ -44,6 +44,10 @@
<param-name>doAuthentication</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>isDefault</param-name>
<param-value>false</param-value>
</context-param>
<!--publish to apim-->
<context-param>

Loading…
Cancel
Save