如何使用hash来从angularjs URL从UriComponentsBuilder构建URI

时间:2016-12-13 10:28:45

标签: java spring

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

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

1 个答案:

答案 0 :(得分:0)

您可以先尝试构建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);