RestEasyのUriBuilderを使用して文字列URLからURIを作成しようとしていますが、予期しない結果が発生します。次のコードを実行しています。
UriBuilder uriBuilder = UriBuilder.fromPath("http://localhost:8190/items?pageNumber={pageNumber}&pageSize={pageSize}");
System.out.println(uriBuilder.build(1, 10));
期待される結果:
http://localhost:8190/items?pageNumber=1&pageSize=10
実結果:
http://localhost:8190/items%3FpageNumber=1&pageSize=10
fromPath()の代わりにUriBuilder.fromUri()を使用すると、URIの作成中に例外がスローされます
Illegal character in query at index 39: http://localhost:8190/items?pageNumber={pageNumber}&pageSize={pageSize}
39の文字は{です。
文字列全体を解析してURIを部分的に作成したくありません。
RestEasyコードを調べたところ、「?」がエンコードされています。org.jboss.resteasy.util.Encode#pathEncodingからのpathEncodingマップを使用してorg.jboss.resteasy.util.Encode#encodeを使用してビルダーを作成する際の文字。
私の使用法は正しくありませんか、それとも実装は正しくありませんか?