users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Re: Re: Re: UriBuilder, forward slashes, path and segments

From: Marek Potociar <marek.potociar_at_oracle.com>
Date: Thu, 28 Jun 2012 17:34:18 +0200

On Jun 28, 2012, at 4:35 PM, Bill Burke wrote:

>
>
> On 6/28/12 10:34 AM, Marek Potociar wrote:
>>
>> On Jun 1, 2012, at 7:30 PM, Bill Burke wrote:
>>
>>> Well, I'm wrong, there is a workaround if you want to *not*
>>> automatically encode '/', but its unclear which one would give the
>>> desired behavior:
>>>
>>> build() v.s buildFromEncoded()
>>>
>>>
>>> buildFromEncoded should probably only encode illegal characters and
>>> '%', if not followed by two hexadecimal numbers and not '/'.
>>
>> yes.
>>
>> FWIW, the actual fix for the issue is the new set of methods being added
>> to the UriBuilder API as discussed earlier:
>>
>> build(Object[] values, boolean encodeSlashInPath)
>> buildFromMap(Map<String, ?> values, boolean encodeSlashInPath)
>>
>
> So the old buildFromEncoded() is supposed to automatically encodes the '/' even though it is a legal character?

No - neither old, nor "new" buildFromEncoded() impl is supposed to do that. But the problem is if you want to encode the %, but not want to encode the /. In such case you may want to use one of the new methods with second parameter set to "false".

Marek

>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
>