users@jsr311.java.net

Re: JAX-RS: UriBuilder encoding

From: Stephan Koops <Stephan.Koops_at_web.de>
Date: Thu, 24 Jul 2008 10:30:57 +0200

Hi Marc,
>>> What about add build methods, where you could give an encode state?
>>> But UriBuilder.buildFromMap(Map, boolean) is no problem, but
>>> UriBuilder.build(Object..., boolean) won't work. What about
>>> UriBuilder.buildEncode(Object...), which encode all characters, and
>>> UriBuilder.build(Object...) only the characters that must be converted?
>>>
>>> What's the problem with adding a third state for the encode
>>> attribute, and let all other as it is?
>>>
>> I've done the exercise of switching to a single state and the result
>> is significantly simpler. Adding a third state makes things more
>> complex than the status quo. Adding additional build methods that
>> force encoding of % chars in parameter values would be preferable.
>>
> BTW, we could have:
>
> build(boolean, Object...) and buildFromMap(boolean, Map<String, ?
> extends Object>)
I also thought about this, but typically you put switches like this to
the end of the parameter list. But this is also a flexible possibility.
> I think these would negate the need for the static encode method.
Yes, that's what I want. :-)

best regards
   Stephan