Ref: org.springframework.web.util.UriBuilder
I am using UriBuilder
to build a URI for an endpoint
final String response = myWebClient.get()
.uri(uriBuilder -> uriBuilder.scheme("https").path("example.com/mypage").path("/{id}.xml").build(id))
.header(AUTHORIZATION, getAuthorizationHeaderValue(username, password))
.accept(MediaType.TEXT_XML)
.retrieve()
.bodyToMono(String.class)
.block();
However, I already have the value https://example.com/mypage
in a string variable(fetched from the database). Can I use this string directly instead of specifying the scheme and path/host separately? Right now I am splitting the main string into individual parts manually.