jsr339-experts@jax-rs-spec.java.net

[jsr339-experts] Re: Should only UriBuilder build methods have an optional encodePathSlash parameter ?

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Mon, 3 Dec 2012 11:33:02 +0000

On 03/12/12 11:05, Sergey Beryozkin wrote:
> I'm looking at implementing UriBuilder.replaceTemplate methods and the
> fact that one of the methods accepts 'encodePathSlash' makes it
> ambiguous given that the final UriBuilder build() will also accept an
> optional encodePathSlash.
>
> I've also checked the docs at [1]
>
>
> It sort of protects against the case where this final variation of
> build() is given a null array. Is empty array acceptable ? If yes then
> at the build time we can get an ambiguity issue -
> UriBuilder.replaceTemplate requested that one of the path vars should be
> treated as per 'encodePathSlash' parameter value, while later, at the
> build time, the user just requests the opposite...
>
> IMHO, either [1] should have empty arrays blocked too or only build()
> methods should have 'encodePathSlash' parameters

The javadocs restriction won't work because the final build() may still
offer non empty array of template vars not related to the path component.

This is obviously a minor issue but it would be cleaner IMHO to drop two
resolveTemplate methods accepting encodePathSlash

Sergey

>
> Does it make sense ?
>
> Sergey
>
> [1]
> http://jax-rs-spec.java.net/nonav/2.0-SNAPSHOT/apidocs/javax/ws/rs/core/UriBuilder.html#build(java.lang.Object[],%20boolean)
>