Skip to content

Support wildcard path elements at the start of path patterns #35213

@bclozel

Description

@bclozel

While AntPathMatcher usage in MVC applications has been deprecated for a long time at this point, we recently received additional feedback about migration efforts.

PathPattern currently only allows path elements that match multiple path segments at the end of a path pattern; for example:

  1. /spring-framework/file/** matches /spring-framework/file/some/file.txt
  2. /spring-framework/file/{*filename} matches /spring-framework/file/some/file.txt and yields filename=/some/file.txt
  3. /**/file/index.html is not allowed, pattern compilation fails
  4. /{*project}/file/index.html is not allowed, pattern compilation fails
  5. /spring-framework/**/index.html is not allowed, pattern compilation fails
  6. /spring-framework/{*folders}/index.html is not allowed, pattern compilation fails

We would like to improve this situation by allowing 3) and 4). Cases 5) and 6) have been requested in the past (see #22847) but they will still be disallowed as the matching process is hard to define properly and creates undesired behavior.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions