Skip to content

Commit d5a8659

Browse files
committed
fix: spring mvc api gather path with ContextPath
1 parent b8fab6c commit d5a8659

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

dongtai-api-gather/dongtai-api-gather-spring-api/src/main/java/io/dongtai/iast/api/gather/spring/convertor/RequestMappingInfoConvertor.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ private void parsePathPatternsRequestCondition() {
5656
Path path = new Path();
5757
// 方法是第二级
5858
parseRequestMethodsRequestCondition(path);
59-
pathMap.put(s, path);
59+
pathMap.put(buildFullUrl(s), path);
6060
});
6161
}
6262
} catch (Throwable e) {
@@ -73,7 +73,7 @@ public void accept(String s) {
7373
Path path = new Path();
7474
// 方法是第二级
7575
parseRequestMethodsRequestCondition(path);
76-
pathMap.put(s, path);
76+
pathMap.put(buildFullUrl(s), path);
7777
}
7878
});
7979
}
@@ -82,6 +82,15 @@ public void accept(String s) {
8282
}
8383
}
8484

85+
private String buildFullUrl(String path) {
86+
String contextPath = this.webApplicationContext.getApplicationName();
87+
if (contextPath == null || contextPath.isEmpty()) {
88+
return path;
89+
} else {
90+
return contextPath + path;
91+
}
92+
}
93+
8594
/**
8695
* 根据请求方法扩展为多个
8796
*/

0 commit comments

Comments
 (0)