Affects: 5.2.8.RELEASE
UriComponentsBuilder.pathSegment
doesn't allow segments "without text". Those segments are valid, so I think the API should allow to build them ? Or at least document the existing behavior ?
jshell> UriComponentsBuilder.newInstance().pathSegment("a","","c").encode().build().toString()
$119 ==> "/a/c"
//should this be "/a//c" ?
jshell> UriComponentsBuilder.newInstance().pathSegment("a"," ","c").encode().build().toString()
$120 ==> "/a/c"
//should this be "/a/%20/c" ?
jshell> UriComponentsBuilder.newInstance().pathSegment("a"," b","c").encode().build().toString()
$121 ==> "/a/%20b/c"
//OK
Comment From: rstoyanchev
UriComponentsBuilder
aims to eliminate empty path segments, even if they are legal, so it is by design but it could be documented more clearly. The path
method has a mention, pathSegment
doesn't say anything.