Use UriComponentsBuilder for building URIs.

No functional changes.