Skip to content

Expose matched PathPattern as MVC request attribute - #37272

Open
Eymenonar wants to merge 1 commit into
spring-projects:mainfrom
Eymenonar:gh-37270-mvc-path-pattern-attribute
Open

Eymenonar wants to merge 1 commit into
spring-projects:mainfrom
Eymenonar:gh-37270-mvc-path-pattern-attribute

Conversation

@Eymenonar

Copy link
Copy Markdown

Provide BEST_MATCHING_PATH_PATTERN_ATTRIBUTE for MVC requests handled with parsed patterns while keeping the existing String attribute unchanged.

Closes gh-37270

Tests: ./gradlew :spring-webmvc:check

Closes spring-projectsgh-37270

Signed-off-by: Eymen <eymenonar123@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 11, 2026
@sbrannen

Copy link
Copy Markdown
Member

I have not fully reviewed of the proposal, but at a glance it looks like we'd want to set the new BEST_MATCHING_PATH_PATTERN_ATTRIBUTE twice in RequestMappingInfoHandlerMapping (instead of just once) as well as in AbstractUrlHandlerMapping and RouterFunctionMapping.

Also, we'll likely want to add more thorough test coverage for the various use cases: path pattern in use, path pattern not in use, path pattern not set, etc.

In any case, we'll discuss your general proposal within the team.

@sbrannen sbrannen added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Sep 14, 2026
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) status: waiting-for-triage An issue we've not yet triaged or decided on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide the matched PathPattern as a request attribute in MVC

3 participants