[jax-rs-spec users] [jsr339-experts] Re: Re: Why do we need new UriInfo Methods?

From: Santiago Pericas-Geertsen <>
Date: Tue, 29 Jan 2013 09:18:39 -0500

On Jan 28, 2013, at 6:14 PM, Bill Burke <> wrote:

> Where these a copy paste errors in UriInfo?
> public URI resolve(URI baseUri, URI uri);
> public URI relativize(URI from, URI uri);
> As they don't make any sense...
> I don't understand why we need any of these methods when you can just do:
> uriInfo.getBaseURI().resolve(uri);
> uriInfo.getBaseURI().relativize(uri);

 The problem is that the JDK methods are limited (or broken, depending how you look at it). Consider the following example:

        URI ab = URI.create("http://host/a/b");
        URI abc = URI.create("http://host/a/b/c");
        URI ad = URI.create("http://host/a/d");

        ab.relativize(abc) ===> "c"
        ab.relativize(ad) ===> "http://host/a/d" ????

 See [1]. There are lots of discussions about custom implementations to resolve this, so I thought it would be useful for us to provide one.

-- Santiago