Reputation: 101
I need to construct a relative path from incoming query string parameters from the front-end. Then I need to append it to the service URL like this:
Front end executes:
Http://backendhost.com?param_one=abd¶m_two=cba
The back-end gets both parameters and needs to execute
https://secure.remote.service/abd/cba
What I have right now on the back-end is this:
https://secure.remote.service
abd
cba
I would like to use a some native library to do this without hacking away using the form
"/" + param1 + "/" param2
This needs to be created and passed to a function that later will extract the back-end secure URL. So not this:
new URL(url, relativePath);
Upvotes: 0
Views: 4035
Reputation: 76
Why not to use an UriBuilder? it was already discussed here:
What is the idiomatic way to compose a URL or URI in Java? and here:
Is there a right way to build a URL?
Upvotes: 1