Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for servletPath prefix with PathPatternParser in Spring MVC #26445

Closed
rstoyanchev opened this issue Jan 26, 2021 · 0 comments
Closed
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@rstoyanchev
Copy link
Contributor

rstoyanchev commented Jan 26, 2021

Currently, when parsed patterns are configured for use, we create a RequestPath by parsing the requestURI without having to decode it first which avoids issues with encoded reserved characters. For pathWithinApplication() we take into account the contextPath but not the servletPath. It is a challenge to work with the servletPath because it is decoded and somewhat normalized and that makes it difficult to use to do a sub-string match against the requestURI in order to determine the remaining path.

This is okay for the needs of the default Servlet mapping "/" which is the most common way to configure the DispatcherServlet but in some cases there is a need to run two Servlets side by side.

The goal of this issue is to add support for allow the DispatcherServlet to be mapped by prefix, so it can run side by side with another Servlet, and still be able to enable use of parsed patterns. We can do this by checking that the HttpServletMapping is MappingMatch.PATH (Servlet 4.0+), re-encoding the servletPath in order to make it comparable to the requestURI, and then exposing a RequestPath that omits contextPath and the servletPath from the pathWithinApplication().

@rstoyanchev rstoyanchev added in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement labels Jan 26, 2021
@rstoyanchev rstoyanchev added this to the 5.3.4 milestone Jan 26, 2021
@rstoyanchev rstoyanchev self-assigned this Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant