First example:
UriBuilder.fromUri("http://localhost")
.queryParam("foo", "test")
.clone()
.build()
// equals to: "http://localhost/?foo=test"
Second example:
UriBuilder.fromUri("http://localhost")
.replaceQueryParam("foo", "test")
.clone()
.build()
// equals to: "http://localhost/"
It should be like this or it’s a defect (in Jersey 1.11)?
It was a defect in Jersey, and it’s already fixed: http://java.net/jira/browse/JERSEY-1081