Say I have a URL
http://example.com/query?q=
and I have a query entered by the user such as:
random word £500 bank
Using Spring's UriComponentsBuilder:
UriComponentsBuilder .fromUriString(url) .build() .encode() .toUri()