users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Re: UriBuilder resolveTemplateFromEncoded

From: Bill Burke <bburke_at_redhat.com>
Date: Mon, 03 Dec 2012 09:57:23 -0500

On 12/3/2012 7:19 AM, Sergey Beryozkin wrote:
> If it is agreed that UriBuilder.build() 'makes' the final and only
> decision on what to do with encoding slashes in path vars, then the same
> applies to
>
> UriBuilder.resolverTemplateFromEncoded: it either build() or
> buildFromEncoded() which 'decides'.
>
> I don't think a case for supporting a combination of encoded and
> not-encoded vars was under the radar when resolveTemplate methods were
> added. But at the moment one can resolveTemplate() and
> resolveTemplateFromEncoded() and then call build() or buildFromEncoded()
> - this is possible to handle - but IMHO it will be much simpler if the
> assumption is made, same as it was before, that it is a sequence of only
> already encoded or not-encoded vars that has to be dealt with.
>
> Thus I propose to drop resolverTemplateFromEncoded() methods
>
> This will leave two resolveTemplate methods, and the decision on how to
> handle the template vars will be done by calling build() or
> buildFromEncoded()
>

-1. You may be building a template, and buildXXXX() may never be called.

UriBuilder builder = UriBuilder.fromUri("/album/{name}/customers/{custid}");
String template = builder.resolveTemplate("name",
"Thrash%20Band").toTemplate();

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