Skip to content

Configure PatternsRequestCondition with information that allows it to do a smart suffix pattern match [SPR-8474] #13120

@spring-projects-issues

Description

@spring-projects-issues

Rossen Stoyanchev opened SPR-8474 and commented

With suffix pattern matching "/users" also matches to "/users.*". This is useful for content type negotiation - e.g. /users.xml, /users.pdf - but can lead to ambiguity when extracting URI template variables.

For example given "/users/{user}":

  1. "/users/1.json" should extract "1"
  2. "/users/john.j.joe" should extract "john.j.joe"

Currently the above cannot be supported at the same time. You can only turn suffix pattern matching on or off. A simple solution could look for a single "." only but then this would be impossible:

"/users/john.j.joe.json" should extract "john.j.joe"

Ideally the PatternsRequestCondition should be able to decide if the suffix represents a known file extension (.xml, .json) similar to how the ContentNegotiatingViewResolver is configured today.

This should become possible as part of the content negotiation improvements planned for Spring 3.2 (#13057).


Affects: 3.1 M2

This issue is a sub-task of #13057

Issue Links:

Referenced from: commits 4fd7645, 9cc4bd8

2 votes, 3 watchers

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: duplicateA duplicate of another issuetype: taskA general task

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions