Skip to content

UriComponentsBuilder should also contain subtractive methods [SPR-8803] #13445

Closed
@spring-projects-issues

Description

@spring-projects-issues

Kenneth DeLong opened SPR-8803 and commented

UriComponentsBuilder should have methods also to subtract and remove items from the URI. For example, I might want to take the current URL and remove the pagination parameter from the URL:

UriComponentsBuilder.parse(request).removeParameter("page").build();

Also, I might want to change the UriPath

UriComponentsBuilder.parse(request).removeParameter("page").setUriPath("/new/path").build();

The advantage of this is we might want to keep the incoming request's DNS name, port, scheme, etc. This is a portable way of constructing URLs across environments (dev/qa/staging/prod).

URLs are not always used for redirecting etc. I might need to send out an email with a link to some page on the site. I could use the above functionality to construct a URL with the correct port, scheme, etc. in a simple portable fashion.


Affects: 3.1 RC1

Issue Links:

Referenced from: commits 2a39f34, d3f4c69

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