Dannyvas
Dannyvas

Reputation: 101

How to create a relative path to append to a URL that is not using the java.nio.file in JAVA?

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&param_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

Upvotes: 0

Views: 4035

Answers (1)

Lukasz Szwajkowski
Lukasz Szwajkowski

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

Related Questions