mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Fixing the empty methods for resources in the synapse configuration issue when auto publishing the apis for the REST service.
This commit is contained in:
parent
04396cd7b3
commit
00e57bd800
@ -64,6 +64,7 @@ public class APIPublisherServiceImpl implements APIPublisherService {
|
|||||||
CommonUtil.getRootSystemRegistry(tenantId));
|
CommonUtil.getRootSystemRegistry(tenantId));
|
||||||
APIProvider provider = APIManagerFactory.getInstance().getAPIProvider(api.getApiOwner());
|
APIProvider provider = APIManagerFactory.getInstance().getAPIProvider(api.getApiOwner());
|
||||||
MultitenantUtils.getTenantDomain(api.getApiOwner());
|
MultitenantUtils.getTenantDomain(api.getApiOwner());
|
||||||
|
processHttpVerbs(api);
|
||||||
if (provider != null) {
|
if (provider != null) {
|
||||||
if (provider.isDuplicateContextTemplate(api.getContext())) {
|
if (provider.isDuplicateContextTemplate(api.getContext())) {
|
||||||
throw new APIManagementException(
|
throw new APIManagementException(
|
||||||
@ -172,6 +173,31 @@ public class APIPublisherServiceImpl implements APIPublisherService {
|
|||||||
return swaggerDefinition.toString();
|
return swaggerDefinition.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sometimes the httpVerb string attribute is not existing in
|
||||||
|
* the list of httpVerbs attribute of uriTemplate. In such cases when creating the api in the
|
||||||
|
* synapse configuration, it doesn't have http methods correctly assigned for the resources.
|
||||||
|
* Therefore this method takes care of such inconsistency issue.
|
||||||
|
*
|
||||||
|
* @param api The actual API model object
|
||||||
|
*/
|
||||||
|
private void processHttpVerbs(API api){
|
||||||
|
for (URITemplate uriTemplate : api.getUriTemplates()){
|
||||||
|
String httpVerbString = uriTemplate.getHTTPVerb();
|
||||||
|
String[] httpVerbs = uriTemplate.getMethodsAsString().split(" ");
|
||||||
|
boolean httpVerbStringExistsMethods = false;
|
||||||
|
for (String aHttpVerb: httpVerbs){
|
||||||
|
if (aHttpVerb.trim().equalsIgnoreCase(httpVerbString)){
|
||||||
|
httpVerbStringExistsMethods = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!httpVerbStringExistsMethods){
|
||||||
|
uriTemplate.setHttpVerbs(httpVerbString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeAPI(APIIdentifier id) throws APIManagementException {
|
public void removeAPI(APIIdentifier id) throws APIManagementException {
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user