gpt4 book ai didi

java - 如何从带有哈希值的 angularjs URL 从 UriComponentsBuilder 构建 URI

转载 作者:太空宇宙 更新时间:2023-11-04 11:58:45 24 4
gpt4 key购买 nike

您好,如何使用“http://test.com/#/signup ”成功创建 UriComponentsBuilder?以下代码将抛出无效的 HTTP url。

UriComponentsBuilder builder = UriComponentsBuilder
.fromHttpUrl("http://test.com/#/signup");

最佳答案

您可以尝试先构造URI,然后用它来初始化构建器:

URI uri = new URI.create("http://test.com/#/signup");
// hash part going to be available like this
String fragment = uri.getFragment();

UriComponentsBuilder builder = UriComponentsBuilder.fromUri(uri);

关于java - 如何从带有哈希值的 angularjs URL 从 UriComponentsBuilder 构建 URI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41118818/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com