javax.ws.rs.core.UriBuilder
没有}
正确转义:
import javax.ws.rs.core.UriBuilder;
public void test() {
final UriBuilder builder = UriBuilder.fromUri("http://host");
builder.path("dir}one");
l.info(builder.toString());
}
将输出http://host/dir}one
,不}
转义。
鉴于org.apache.http.client.utils.URIBuilder
:
org.apache.http.client.utils.URIBuilder;
public void testApache() {
final URIBuilder builder = new URIBuilder(URI.create("http://host"));
builder.setPath("dir}one");
l.info(builder.toString());
}
将输出,按预期http://hostdir%7Done
转义。}
%7D
这是一个错误javax.ws.rs.core.UriBuilder
吗?