|
41 | 41 | import org.springframework.http.HttpStatus; |
42 | 42 | import org.springframework.http.ResponseEntity; |
43 | 43 | import org.springframework.web.util.ForwardedHeaderUtils; |
| 44 | +import org.springframework.web.util.ServletRequestPathUtils; |
44 | 45 | import org.springframework.web.util.UriComponentsBuilder; |
45 | | -import org.springframework.web.util.UrlPathHelper; |
46 | 46 |
|
47 | 47 | /** |
48 | 48 | * The type Swagger welcome common. |
|
51 | 51 | */ |
52 | 52 | public abstract class SwaggerWelcomeCommon extends AbstractSwaggerWelcome { |
53 | 53 |
|
54 | | - private final UrlPathHelper urlPathHelper = new UrlPathHelper(); |
55 | | - |
56 | 54 | /** |
57 | 55 | * Instantiates a new Abstract swagger welcome. |
58 | 56 | * |
@@ -112,11 +110,11 @@ protected void calculateOauth2RedirectUrl(SwaggerUiConfigParameters swaggerUiCon |
112 | 110 | * @param swaggerUiConfigParameters the swagger ui config parameters |
113 | 111 | * @param request the request |
114 | 112 | */ |
115 | | - void buildFromCurrentContextPath(SwaggerUiConfigParameters swaggerUiConfigParameters, HttpServletRequest request) { |
| 113 | + protected void buildFromCurrentContextPath(SwaggerUiConfigParameters swaggerUiConfigParameters, HttpServletRequest request) { |
116 | 114 | super.init(swaggerUiConfigParameters); |
117 | 115 |
|
118 | | - String pathWithinServletMapping = urlPathHelper.getPathWithinServletMapping(request); |
119 | | - String contextPath = request.getContextPath() + (!StringUtils.isBlank(pathWithinServletMapping) ? request.getServletPath() : ""); |
| 116 | + String servletPath = ServletRequestPathUtils.getServletPathPrefix(request); |
| 117 | + String contextPath = request.getContextPath() + (servletPath != null ? servletPath : ""); |
120 | 118 | swaggerUiConfigParameters.setContextPath(contextPath); |
121 | 119 |
|
122 | 120 | URI uri = URI.create(request.getRequestURL().toString()); |
|
0 commit comments