修复context-path识别问题

1.x
tanghc 5 years ago
parent 22409fc3cc
commit c2e406edcc
  1. 9
      sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/manager/ServiceZookeeperApiMetaManager.java

@ -37,6 +37,8 @@ public class ServiceZookeeperApiMetaManager implements ApiMetaManager {
private static final String PATH_SPLIT = "/";
private static final String DEFAULT_CONTEXT_PATH = "/";
private Environment environment;
private ZookeeperTool zookeeperTool;
@ -146,14 +148,13 @@ public class ServiceZookeeperApiMetaManager implements ApiMetaManager {
}
protected String buildServletPath(ServiceApiInfo serviceApiInfo, ServiceApiInfo.ApiMeta apiMeta) {
String contextPath = environment.getProperty("server.servlet.context-path", DEFAULT_CONTEXT_PATH);
String servletPath = apiMeta.getPath();
if (servletPath == null) {
servletPath = "";
}
if (!servletPath.startsWith(PATH_SPLIT)) {
servletPath = PATH_SPLIT + servletPath;
}
return servletPath;
StringUtils.trimLeadingCharacter(servletPath, '/');
return contextPath + servletPath;
}
/**

Loading…
Cancel
Save