Skip to content

Expose matched PathPattern as MVC request attribute - #37272

Merged
bclozel merged 2 commits into
spring-projects:mainfrom
Eymenonar:gh-37270-mvc-path-pattern-attribute
Sep 18, 2026
Merged

bclozel merged 2 commits 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

@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
@bclozel
bclozel force-pushed the gh-37270-mvc-path-pattern-attribute branch from 190fd8d to b541a62 Compare September 18, 2026 15:15
bclozel added a commit to Eymenonar/spring-framework that referenced this pull request Sep 18, 2026
@bclozel bclozel self-assigned this Sep 18, 2026
@bclozel bclozel added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 18, 2026
@bclozel bclozel added this to the 7.1.0-M2 milestone Sep 18, 2026
Eymen and others added 2 commits September 18, 2026 17:21
@bclozel
bclozel force-pushed the gh-37270-mvc-path-pattern-attribute branch from b541a62 to f6e53b7 Compare September 18, 2026 15:21
@bclozel
bclozel merged commit f6e53b7 into spring-projects:main Sep 18, 2026
1 check failed
@bclozel

bclozel commented Sep 18, 2026

Copy link
Copy Markdown
Member

Thanks for your contribution @Eymenonar !

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

Successfully merging this pull request may close these issues.

Provide the matched PathPattern as a request attribute in MVC

4 participants