http://username:password@localhost 使用 UriComponentsBuilder ?
http://username:password@localhost
UriComponentsBuilder
path 价值
path
.path(String.format("%s:%s@", getUsername(), getPassword()))
但是,这只是在构建时附加到URI的末尾。
(此调用的第三方应用程序不支持标头和其他身份验证方法)
我想这是不支持的?
UriComponents uriComponents = UriComponentsBuilder.newInstance() .scheme("http").host(String.format("%s:%s@", getUsername(), getPassword()))
使用主机方法。路径方法将始终附加到结尾,并提供路径分隔符 / 你不想要的
/