嗨,如何使用“ 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);