如何创建相对路径以附加到未在 JAVA 中使用 java.nio.file 的 URL?

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

我需要根据来自前端的传入查询字符串参数构造一个相对路径。 然后我需要像这样将它附加到服务 URL 中:

前端执行:

Http://backendhost.com?param_one=abd&param_two=cba

后端获取到两个参数,需要执行

https://secure.remote.service/abd/cba

我现在在后端的是这样的:

https://secure.remote.service
abd
cba

我想使用一些本机库来执行此操作,而无需使用表单

"/" + param1 + "/" param2

为什么不使用 UriBuilder?已经在这里讨论过:

What is the idiomatic way to compose a URL or URI in Java? 这里:

Is there a right way to build a URL?