Append version only if version type is url
For none and context, the url will be without version
Fixes
@@ -53,6 +53,7 @@ public class ApiResource extends APIResource {
private static Log LOG = LogFactory.getLog(ApiResource.class);
private static final String API_NAME = "apiName";
+ private static final String URL_VERSION_TYPE = "url";
private String serverContext = ""; // base server url
public ApiResource(String urlTemplate) {
@@ -215,7 +216,7 @@ public class ApiResource extends APIResource {
org.apache.axis2.context.MessageContext axisMsgCtx = ((Axis2MessageContext) msgCtx).getAxis2MessageContext();
String serverUrl = getServerContext(axisMsgCtx.getConfigurationContext().getAxisConfiguration());
String versionUrl = "";
- if (!api.getVersion().isEmpty()) {
+ if (URL_VERSION_TYPE.equals(api.getVersionStrategy().getVersionType()) && !api.getVersion().isEmpty()) {
versionUrl = "/" + api.getVersion();
}
return serverUrl.equals("err") ? api.getContext() : serverUrl + api.getContext() + versionUrl;
