diff --git a/components/registry/org.wso2.carbon.registry.extensions/src/main/java/org/wso2/carbon/registry/extensions/handlers/EndpointMediaTypeHandler.java b/components/registry/org.wso2.carbon.registry.extensions/src/main/java/org/wso2/carbon/registry/extensions/handlers/EndpointMediaTypeHandler.java index 439daf2ed..d60266a7d 100644 --- a/components/registry/org.wso2.carbon.registry.extensions/src/main/java/org/wso2/carbon/registry/extensions/handlers/EndpointMediaTypeHandler.java +++ b/components/registry/org.wso2.carbon.registry.extensions/src/main/java/org/wso2/carbon/registry/extensions/handlers/EndpointMediaTypeHandler.java @@ -69,6 +69,10 @@ public void setEndpointMediaType(String endpointMediaType) throws RegistryExcept EndpointUtils.setEndpointMediaType(endpointMediaType); } + public void setIncludeNamespaceInName(String includeNamespaceInName){ + EndpointUtils.setIncludeNamespaceInName(Boolean.valueOf(includeNamespaceInName)); + } + public String getEndpointMediaType() throws RegistryException { return EndpointUtils.getEndpointMediaType(); } diff --git a/components/registry/org.wso2.carbon.registry.extensions/src/main/java/org/wso2/carbon/registry/extensions/handlers/utils/EndpointUtils.java b/components/registry/org.wso2.carbon.registry.extensions/src/main/java/org/wso2/carbon/registry/extensions/handlers/utils/EndpointUtils.java index 0c5ee0c69..ad2333e55 100644 --- a/components/registry/org.wso2.carbon.registry.extensions/src/main/java/org/wso2/carbon/registry/extensions/handlers/utils/EndpointUtils.java +++ b/components/registry/org.wso2.carbon.registry.extensions/src/main/java/org/wso2/carbon/registry/extensions/handlers/utils/EndpointUtils.java @@ -74,6 +74,16 @@ public class EndpointUtils { private static String endpointLocation = ENDPOINT_DEFAULT_LOCATION; private static String endpointMediaType = CommonConstants.ENDPOINT_MEDIA_TYPE; + private static boolean includeNamespaceInName = false; + + public static boolean isIncludeNamespaceInName() { + return includeNamespaceInName; + } + + public static void setIncludeNamespaceInName(boolean includeNamespaceInName) { + EndpointUtils.includeNamespaceInName = includeNamespaceInName; + } + public static void setEndpointLocation(String endpointLocation) { EndpointUtils.endpointLocation = endpointLocation; } @@ -837,7 +847,11 @@ public static String deriveEndpointNameWithNamespaceFromUrl(String url) { String namespace = deriveEndpointNamespaceFromUrl(url).replace("//", "/"); namespace = namespace.replace("/", "."); namespace += "-"; - return ENDPOINT_RESOURCE_PREFIX + namespace +name; + if (isIncludeNamespaceInName()){ + return ENDPOINT_RESOURCE_PREFIX + namespace +name; + } else { + return ENDPOINT_RESOURCE_PREFIX + name; + } } /** diff --git a/components/registry/org.wso2.carbon.registry.extensions/src/test/java/org/wso2/carbon/registry/extensions/test/EndpointUtilsTest.java b/components/registry/org.wso2.carbon.registry.extensions/src/test/java/org/wso2/carbon/registry/extensions/test/EndpointUtilsTest.java index 7343a9cfa..21cfde19e 100644 --- a/components/registry/org.wso2.carbon.registry.extensions/src/test/java/org/wso2/carbon/registry/extensions/test/EndpointUtilsTest.java +++ b/components/registry/org.wso2.carbon.registry.extensions/src/test/java/org/wso2/carbon/registry/extensions/test/EndpointUtilsTest.java @@ -33,11 +33,11 @@ public void testEndpointContentWithOverview() throws RegistryException { StringBuilder endpointContent2 = new StringBuilder(); endpointContent1.append("ep-net.webservicex.www-convertVolume-asmxep-convertVolume-asmx1.0.0
http://www.webservicex.net/con") .append("vertVolume.asmx
"); endpointContent2.append("ep-net.webservicex.www-convertMetricWeight-asmx") + .append(">ep-convertMetricWeight-asmx") .append("1.0.0
http://www.webservicex.ne") .append("t/convertMetricWeight.asmx
"); @@ -46,11 +46,11 @@ public void testEndpointContentWithOverview() throws RegistryException { StringBuilder endpointContent1_2 = new StringBuilder(); StringBuilder endpointContent2_2 = new StringBuilder(); endpointContent1_2.append("ep-net.webservicex.www-convertVolume-asmxep-convertVolume-asmx1.0.0version
http://www.webservicex.net/con") .append("vertVolume.asmx
"); endpointContent2_2.append("ep-net.webservicex.www-convertMetricWeight-asmx") + .append(">ep-convertMetricWeight-asmx") .append("1.0.0version
http://www.webservicex.ne") .append("t/convertMetricWeight.asmx
"); //