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

PathPatternParser matches root path against path variable [SPR-15264] #19829

Closed
spring-projects-issues opened this issue Feb 17, 2017 · 1 comment
Closed
Assignees
Labels
in: web type: bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Feb 17, 2017

Arjen Poutsma opened SPR-15264 and commented

The PathPatternParser will match the pattern "/{foo}" against the path "/". This is a regression: the AntPathMatcher will not match with the same parameters.

The rationale: path/URI template variables (i.e. patterns with curly braces) should be considered required, and not optional. In that sense, they cannot be considered the same as wildcard matches (i.e. "/*" should match the path "/", but "/{foo}" should not). If they would be optional, we could not resolve the @PathVariable parameters in a @RequestMapping method.


Affects: 5.0 M5

Referenced from: commits d924538, f1653cc

1 votes, 3 watchers

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Feb 20, 2017

Andy Clement commented

Two commits to fix this. When a single variable is used a particular PathElement subclass is built, optimized for that scenario. The first commit fixed this PathElement. It then occurred to me that when multiple variables are bound, a different PathElement subclass is built. The second commit fixes that other PathElement. Testcases added.

@spring-projects-issues spring-projects-issues added type: bug in: web labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 5.0 M5 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web type: bug
Projects
None yet
Development

No branches or pull requests

2 participants