Skip to content

Commit

Permalink
perf: Aggregation聚合代码针对父项目使用设置context-path属性的支持
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoymin committed Aug 29, 2022
1 parent f17120f commit 65d17dc
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ protected void buildContext(RouteRequestContext routeRequestContext, HttpServlet
//判断当前聚合项目的contextPath
if (StrUtil.isNotBlank(this.rootPath) && !StrUtil.equals(this.rootPath, ROUTE_BASE_PATH)) {
fromUri = fromUri.replaceFirst(this.rootPath, "");
//此处需要追加一个请求头basePath,因为父项目设置了context-path
routeRequestContext.addHeader("X-Forwarded-Prefix",this.rootPath);
}
//判断servicePath
if (StrUtil.isNotBlank(swaggerRoute.getServicePath()) && !StrUtil.equals(swaggerRoute.getServicePath(),
Expand Down Expand Up @@ -299,4 +301,8 @@ public SwaggerRoute getRoute(String header) {
public List<SwaggerRoute> getRoutes() {
return routeRepository.getRoutes();
}

public String getRootPath() {
return rootPath;
}
}

0 comments on commit 65d17dc

Please sign in to comment.