有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

url Java:在查询参数之前使用片段构建URI

我希望构建以下类型的URI: https://example.com/index.html#db/report/csv?token=4cec23a8a07b63c1ed74&time=1473951700000&name=GA

但我尝试的是产生错误的结果:

UriBuilder.fromUri("https://example.com").path("index.html#db/report/csv").queryParam("token", "4cec23a8a07b63c1ed74").queryParam("time", "1473951700000").queryParam("name", "GA").build();

上面是对#进行编码,并导致

https://example.com/index.html%23db/report/csv?token=4cec23a8a07b63c1ed74&time=1473951700000&name=GA

如何不对#进行编码,同时仍然获得所需的Url


共 (0) 个答案