Commit 7870283bfa8a2b2242d6498e79d390d6271826d6
Committed by
Gitee
!594 兼容spring web 配置上下文根路径的情况
Merge pull request !594 from suyh/master
Showing
1 changed file
with
2 additions
and
3 deletions
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/util/WebFrameworkUtils.java
| 1 | package cn.iocoder.yudao.framework.web.core.util; | 1 | package cn.iocoder.yudao.framework.web.core.util; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.util.NumberUtil; | 3 | import cn.hutool.core.util.NumberUtil; |
| 4 | -import cn.hutool.core.util.StrUtil; | ||
| 5 | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | 4 | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; |
| 6 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 7 | import cn.iocoder.yudao.framework.web.config.WebProperties; | 6 | import cn.iocoder.yudao.framework.web.config.WebProperties; |
| @@ -89,10 +88,10 @@ public class WebFrameworkUtils { | @@ -89,10 +88,10 @@ public class WebFrameworkUtils { | ||
| 89 | return userType; | 88 | return userType; |
| 90 | } | 89 | } |
| 91 | // 2. 其次,基于 URL 前缀的约定 | 90 | // 2. 其次,基于 URL 前缀的约定 |
| 92 | - if (request.getRequestURI().startsWith(properties.getAdminApi().getPrefix())) { | 91 | + if (request.getServletPath().startsWith(properties.getAdminApi().getPrefix())) { |
| 93 | return UserTypeEnum.ADMIN.getValue(); | 92 | return UserTypeEnum.ADMIN.getValue(); |
| 94 | } | 93 | } |
| 95 | - if (request.getRequestURI().startsWith(properties.getAppApi().getPrefix())) { | 94 | + if (request.getServletPath().startsWith(properties.getAppApi().getPrefix())) { |
| 96 | return UserTypeEnum.MEMBER.getValue(); | 95 | return UserTypeEnum.MEMBER.getValue(); |
| 97 | } | 96 | } |
| 98 | return null; | 97 | return null; |