Skip to content

UriComponents should parse the path of a String URI into path segments [SPR-10959] #15587

@spring-projects-issues

Description

@spring-projects-issues

Jean-Louis Jouannic opened SPR-10959 and commented

Expanding an instance of UriComponents with variable on the path gives different results, depending if it was built from a full String template, or if path segments were appended later.

Here is an example taken from the last comments of issue SPR-8662:

String uri = "http://foo/{bar}";
UriComponents uriComponents = UriComponentsBuilder.fromUriString(uri).build();
System.out.println(uriComponents.expand("user/name").encode().toUriString());

produces

http://foo/user/name

whereas

String uri = "http://foo";
UriComponents uriComponents = UriComponentsBuilder.fromUriString(uri).pathSegment("{bar}").build();
System.out.println(uriComponents.expand("user/name").encode().toUriString());

produces

http://foo/user%2Fname

Affects: 3.2.4

Issue Links:

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions