Sorry for the late answer, had been out of office.
Actually I have to disagree to your conclusion! I do not see any difference in path parameters vs. segment parameters. I think your fault is that you think encoding is depentent of the method, but it is solely dependend of the target. And the target of both, path and segment, is the URI's path -- so there is no difference (while there is one for the query part, obviously)! In fact, *both places* have to resolve to an encoded form, as *both* have to take respect of the target, which is the URI's path:
UriBuilder.path("abc/def/{arg1}).segment("123", "456", "{arg1}").build("A/B")
*obviously* have to resolve exactly to:
abc/def/A%2FB/123/456/A%2FB
and to nothing else!
(If arg1 would be a queryParam, too, THEN (!) it would stay as A/B as a slash is valid in the query part of the URI!)
Can you please explain why you think it would be beneficial to *not* encode the provided value? In what case would that make any sense? And what is your source (spec)?
The sole difference between path and segment is only that using path() you can supply a complete chain of segments, i. e. path("abc/def"), while you have to provide a set of segments using segment(), i. e. segment ("abc", "def"). In fact, it is a fault to provide a slash to a segment as by URI's definition, a segment cannot contain a slash.
But, that has nothing to do with encoding! Encoding will *always* be applied to any build() paramater's value *according to the template parameter's position in the template"! That means, a slash must be encoded in a path() or segment() template, but not in a queryParam() template. And, whatever is given to path() or segment(), will itself get never encoded, as only the values provided to build() are getting encoded.
Everything else just makes no sense to me.
Or can you provide a real world example, where it makes sense to either encode the value given to path() or segment() / not to encode the value given to build()?
Regards
Markus
> -----Original Message-----
> From: Sergey Beryozkin [mailto:sberyozkin_at_talend.com]
> Sent: Dienstag, 25. Oktober 2011 23:27
> To: jsr339-experts_at_jax-rs-spec.java.net
> Subject: [jsr339-experts] Re: HEADS-UP: Encoding values of UriBuilder
> template parameters
>
>
> On 25/10/11 20:50, Marek Potociar wrote:
> > Experts,
> > please read through the following CRITICAL issue& the attached
> comments:
> >
> > http://java.net/jira/browse/JAX_RS_SPEC-70
> >
> > I am interested in your feedback to the conclusion I provided in my
> > comment attached to the issue. Please provide your feedback by Monday
> next week Oct 31, 2011 CoB.
> >
>
> agreed
>
> > Feel free to attach the feedback or any new comments directly to the
> issue.
> >
> > Many thanks,
> > Marek
>
>
> --
> Sergey Beryozkin
>
> http://sberyozkin.blogspot.com
> Talend - http://www.talend.com