Bill Burke wrote:
> Me too. :) decoded keys always.
>
I assumed and implemented encoded keys and values for
UriInfo.get*Parameters(true) and UriInfo.getPathSegments(true). Namely
that you if ask for something in encoded form you get everything in
encoded form. This reduces possible sources of confusion and bugs and
the main idea of encoded form was so that a more advanced developer
could work consistently in encoded form for all such information
extracted from the URI.
UriBuilder.queryParam encodes the value and name if the encode property
is set to true, otherwise validates the value and name if set to false.
If query keys are decoded but query values are not then it is hard to
use UriBuilder.queryParam consistently with
UriInfo.getQueryParameters(false).
Looking more closely i found some issues because the *Param names are
not specified to be in encoded or decoded form, and i did not assume
either way when implementing.
The JavaDoc does not define if @*Param names should be in encoded or
decoded form. Same goes for @DefaultValue. Note that @Encoded does not
apply to values of @Path, for example:
@Path(value="x%20y", encode=false)
I don't like the idea of removing or adding @Encoded and causing things
to fail because other annotation values need to change accordingly
(especially given the scoping rules of @Encoded). I would prefer and
think it would be more consistent (if we choose to support it) that
annotation fields be used as in the case of @Path for the
encoded/decoded form of annotation specified parameter names and default
values.
We also need to specify the encoded/decoded form for:
UriInfo.getAncestorResourceURIs
and perhaps be consistent with other methods with a boolean parameter.
Paul.
> Marc Hadley wrote:
>> Good question. My initial reaction is that names (keys) are always
>> decoded but I'm open to persuasion.
>>
>> Marc.
>>
>> On Mar 25, 2008, at 2:57 PM, Bill Burke wrote:
>>> Another question (and this applies to query strings too), if it is
>>> encoded, is the map's keys encoded or decoded?
>>>
>>> Marc Hadley wrote:
>>>> Good idea, just as well we added annotations to the method signature
>>>> of MessageBodyReader.
>>>> Marc.
>>>> On Mar 25, 2008, at 2:38 PM, Bill Burke wrote:
>>>>> Spec says we have to support
>>>>>
>>>>> application/x-www-form-urlencoded and MultivaluedMap<String, String>
>>>>>
>>>>> Is this a decoded map? How about we combine it with @Encoded?
>>>>> --
>>>>> Bill Burke
>>>>> JBoss, a division of Red Hat
>>>>> http://bill.burkecentral.com
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: dev-unsubscribe_at_jsr311.dev.java.net
>>>>> For additional commands, e-mail: dev-help_at_jsr311.dev.java.net
>>>>>
>>>> ---
>>>> Marc Hadley <marc.hadley at sun.com>
>>>> CTO Office, Sun Microsystems.
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe_at_jsr311.dev.java.net
>>>> For additional commands, e-mail: dev-help_at_jsr311.dev.java.net
>>>
>>> --
>>> Bill Burke
>>> JBoss, a division of Red Hat
>>> http://bill.burkecentral.com
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe_at_jsr311.dev.java.net
>>> For additional commands, e-mail: dev-help_at_jsr311.dev.java.net
>>>
>>
>> ---
>> Marc Hadley <marc.hadley at sun.com>
>> CTO Office, Sun Microsystems.
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_jsr311.dev.java.net
>> For additional commands, e-mail: dev-help_at_jsr311.dev.java.net
>>
>
--
| ? + ? = To question
----------------\
Paul Sandoz
x38109
+33-4-76188109