URL encoding using the new Spring UriComponentsBuilder

UriComponentsBuilder is encoding your URI in accordance with RFC 3986, with section 3.4 about the ‘query’ component of a URI being of particular note.

Within the ‘query’ component, the characters / and : are permitted, and do not need escaping.

To take the / character for example: the ‘query’ component (which is clearly delimited by unescaped ? and (optionally) # characters), is not hierarchical and the / character has no special meaning. So it doesn’t need encoding.

Leave a Comment