Just a follow-up.
It seems wrong that UriBuilder.build() will double-encode a '%' if we have
used replaceQuery(), i.e, provided a query string, but won't double encode
if we built it one by one,
Comments ?
Sergey
On Thu, Sep 23, 2010 at 9:37 PM, Sergey Beryozkin <sberyozkin_at_gmail.com>wrote:
> Hello -
>
> Can someone please give me an authoritative answer about the differences
> between UriBuilder.build() and UriBuilder.buildFromEncoded() and they way
> they have to deal with quieries containing percent-encoded data.
>
> 1. UriBuilder.fromUri("http://localhost:8080").queryParam("name",
> "%20").build();
> 2. UriBuilder.fromUri("http://localhost:8080").queryParam("name",
> "%20").buildFromEncoded();
> 3. UriBuilder.fromUri("http://localhost:8080
> ").replaceQuery("name=%20").build();
> 4. UriBuilder.fromUri("http://localhost:8080
> ").replaceQuery("name=%20").buildFromEncoded();
>
> I'm seriously confused. Specifically, it seems totally wrong that the way
> '%' is dealt with depends on how a query is built (i.e, from individual
> parameters or from a ready string).
>
> I'd appreciate if you can give the answers to 1-4 above.
> Besides, what is the way in UriBuilder to have a literal '%' passed on ?
> Example, should it be :
>
> UriBuilder.fromUri("http://localhost:8080").queryParam("name",
> "%2520").buildFromEncoded();
>
> or
>
> UriBuilder.fromUri("http://localhost:8080
> ").replaceQuery("name=%2520").build();
>
> How about
>
> UriBuilder.fromUri("http://localhost:8080
> ").replaceQuery("name=%2520").buildFromEncoded();
>
> versus
>
> UriBuilder.fromUri("http://localhost:8080
> ").replaceQuery("name=%2520").build();
>
> Thanks !
>
> Sergey
>