[jax-rs-spec users] [jsr339-experts] Re: Desired behavior of UriBuilder.fromResource

From: Markus KARG <>
Date: Thu, 8 Nov 2012 19:48:25 +0100

> Suppose I have:
> @Path("customer/{id}")
> public class CustomerResource {
> When I use UriBuilder.fromResource(CustomerResource.class)
> The builder creates a URI, %-encoding the { and } in the path.
> This sort feels both, wrong and correct :-)
> Question: what is the desired behavior?

The above code is not creating an URI, it is creating an URIBuilder.

To create an URI you must invoke build("MyID") on this URIBuilder, which
creates an URI that looks like "customer/MyID".

If that is not produced by your software, then it is definitively wrong and
you should file a ticket.