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

[jsr339-experts] Re: [jax-rs-spec users] Re: Target: two new properties

From: Santiago Pericas-Geertsen <Santiago.PericasGeertsen_at_oracle.com>
Date: Wed, 7 Sep 2011 09:51:43 -0400

On Sep 7, 2011, at 5:39 AM, Sergey Beryozkin wrote:

> On 06/09/11 19:13, Marek Potociar wrote:
>>
>> There's a one thing that bothers me though:
>>
>> Target t1 = client.target("http://service/1");
>> Target t2 = client.target("http://service").path("1");
>>
>> assertEquals(t1.getUri(), t2.getUri()); // Targeting same resource
>> assertEquals(t1.getBaseUri(), t2.getBaseUri()); // Still fails!!!

 IMO, this clearly shows that "base URI" is a misnomer here. It's really more like the "origin URI" or something like that.

 I'm still struggling to understand the use case, though. So if I have,

 Target baseUri = client.target("http://service");
 Target uri1 = baseUri.path("1");

 why not pass baseUri around and construct all the sub-targets from it? Rather than using uri1 to get back to baseUri?

-- Santiago