users@jsr311.java.net

Difference between UriBuilder.buildFromEncoded and UriBuilder.build

From: Sergey Beryozkin <sberyozk_at_progress.com>
Date: Thu, 12 Mar 2009 13:08:48 -0000

Hi,

Few more questions about UriBuilder.buildFromEncoded().

Basically, affer reading the JavaDocs again, my understanding is that the only difference between UriBuilder.buildFromEncoded() and
UriBuilder.build() is that in the latter case every character is encoded (except for the reserved path segment characters), while
with the former everything is also encoded with the exception of percent-encoded values left untouched.

Is it a correct interpretation ?

Here're 2 examples to verify if I'm getting it right :

assertEquals("http://bar/foo%20%252B+%2520%252?q=+%252B%2B%2520"
                    UriBuilder.fromUri("http://bar/foo %2B+%20%2?q= %2B+%20").build(),toString());

assertEquals("http://bar/foo%20%2B+%20%252?q= +%2B%2B%20"
                    UriBuilder.fromUri("http://bar/foo %2B+%20%2?q= %2B+%20").buildfromEncoded(),toString());

Is it correct?
thanks, Sergey