Description
Rossen Stoyanchev opened SPR-17039 and commented
Historically UriComponents
has always encoded only characters that are illegal in a given part of the URI (e.g. "/" is illegal in a path segment), and that does not include characters that are legal but have some other reserved meaning (e.g. ";" in a path segment, or also "+" in a query param).
UriComponents
has also always relied on expanding URI variables first, and then encoding the expanded String, which makes it impossible to apply stricter encoding to URI variable values which is usually what's expected intuitively, because once expanded it's impossible to tell the values apart from the rest of the template. Typically the expectation is that expanded values will have by fully encoded.
While the RestTemplate and WebClient can be configured with a UriBuilderFactory
that supports different encoding mode strategy, currently there is really no answer when using UriComponents
directly.
Affects: 5.0.7
Issue Links:
- HtmlUnitRequestBuilder decodes plus sign in query parameter [SPR-17027] #21565 HtmlUnitRequestBuilder decodes plus sign in query parameter ("is depended on by")
- UriComponentsBuilder.toUriString() is broken [SPR-17630] #22161 UriComponentsBuilder.toUriString() is broken
- Spring is inconsistent in the encoding/decoding of URLs [SPR-16860] #21399 Spring is inconsistent in the encoding/decoding of URLs ("supersedes")
- Encoding of URI Variables on RestTemplate [SPR-16202] #20750 Encoding of URI Variables on RestTemplate ("supersedes")
- UriComponentsBuilder does not encode "+" properly [SPR-16718] #21259 UriComponentsBuilder does not encode "+" properly ("supersedes")
1 votes, 9 watchers