Skip to main content

[jsr339-experts] Re: [jax-rs-spec users] Re: Re: Re: Re: Are Links build with fromReosurce or fromResourceMethod are useful at all?

  • From: Santiago Pericas-Geertsen <Santiago.PericasGeertsen@...>
  • To: jsr339-experts@...
  • Subject: [jsr339-experts] Re: [jax-rs-spec users] Re: Re: Re: Re: Are Links build with fromReosurce or fromResourceMethod are useful at all?
  • Date: Mon, 26 Nov 2012 15:05:57 -0500


On Nov 26, 2012, at 2:14 PM, Jan Algermissen <jan.algermissen@...> wrote:

> 
> On Nov 26, 2012, at 6:05 PM, Santiago Pericas-Geertsen 
> <Santiago.PericasGeertsen@...> wrote:
> 
>
>> On Nov 26, 2012, at 10:51 AM, Jan Algermissen <jan.algermissen@...> wrote:
>
>>> 
>>> On Nov 26, 2012, at 4:38 PM, Santiago Pericas-Geertsen 
>>> <Santiago.PericasGeertsen@...> wrote:
>>> 
>>>> 
>>>> On Nov 20, 2012, at 4:14 PM, Jan Algermissen <jan.algermissen@...> wrote:
>>>> 
>>>>> 
>>>>> On Nov 16, 2012, at 11:11 PM, Santiago Pericas-Geertsen 
>>>>> <Santiago.PericasGeertsen@...> wrote:
>>>>> 
>>>>>> 
>>>>>> On Nov 16, 2012, at 4:46 PM, Jan Algermissen <jan.algermissen@...> 
>>>>>> wrote:
>>>>>> 
>>>>>>> 
>>>>>>> On Nov 16, 2012, at 10:40 PM, Santiago Pericas-Geertsen 
>>>>>>> <Santiago.PericasGeertsen@...> wrote:
>>>>>>> 
>>>>>>>> Jan,
>>>>>>>> 
>>>>>>>> My gut reaction is that we should not absolutize URIs on the server, 
>>>>>>>> it can lead to all sorts of problems (clustering environments, etc.).
>>>>>>> 
>>>>>>> Yes. That was what I came to, too (in my However(!) sentence)
>>>>>> 
>>>>>> I see.
>>>>>> 
>>>>>>> 
>>>>>>>> We should instead have the notion of a base URI on the client, and 
>>>>>>>> have the client API do the work, just like a browser. 
>>>>>>> 
>>>>>>> That is the problem. The existing base URI 'determining' algorithm 
>>>>>>> will lead to anything, but never to the JAX-RS application path.
>>>>>> 
>>>>>> I didn't mean we'd do this automatically. We should ask the "human" 
>>>>>> developer for help :)
>>>>>> 
>>>>>>> I am now thinking that there is 'concept' missing - I'll think about 
>>>>>>> it and see if I get an idea of it, at least.
>>>>>> 
>>>>>> Sounds good.
>>>>> 
>>>>> What about putting an alternative Link/Uri -fromResourceXX() base URI 
>>>>> in ApplicationConfig?
>>>>> 
>>>>> @javax.ws.rs.ApplicationPath("resources")
>>>>> @javax.ws.rs.BaseUri("http://service.ex.org/erp-system/api";)
>>>>> public class ApplicationConfig extends javax.ws.rs.core.Application {
>>>>> 
>>>>> }
>>>>> 
>>>>> Not ideal, but maybe it triggers other thoughts.
>>>> 
>>>> I don't think this will generally work in a clustering environment (with 
>>>> load balancers, etc.). It may work if that info is in a deployment 
>>>> descriptor, but having to recompile my app just to deploy it correctly 
>>>> is clearly undesirable. 
>>>> 
>>>> What about introducing the notion of a base URI as part of the Client 
>>>> API? 
>>> 
>>> That won't work because the base URI for relative URI references in HTTP 
>>> responses is already defined by the HTTP & friends spec stack. This is 
>>> nothing you can override or tamper with.
>
>> I don't understand this, can you send some links explaining that? 
>
>>> This is why having Link.fromXXX produce relative URI refs makes the whole 
>>> thing useless. You definitely need to prepend a base URI. And for that 
>>> you need to create a new Link object via a roundtrip through UriBuilder.
>
>> Browsers resolve relative URIs all the time, so it can't be useless. There 
>> are various mechanisms for converting a relative URI to an absolute one. I 
>> believe this is the one that applies to our client API:
>
>http://tools.ietf.org/html/rfc3986#section-5.1.4
> 
> No, this section only applies if the other's do not. You have to look at 
> 5.1.1 to 5.1.3.

 I don't see how 5.1.1 or 5.1.2 apply here. As for 5.1.3, I understand how 
this may apply but I don't see the problem of overriding this to pick 5.1.4 
when designing a _Java API_. The notion of resolving relative URIs given an 
(external) base URI in an API has been used before, because it just makes 
sense from a practical point of view.

 The only other alternative that I can think of is to generate all the server 
URIs relative to the request URI. This may work but adds complexity to the 
implementation and application. Additionally, on the client API, we may need 
to eagerly absolutize URIs or store information to co-relate request and 
responses. 

-- Santiago




[jsr339-experts] Are Links build with fromReosurce or fromResourceMethod are useful at all?

Jan Algermissen 11/14/2012

[jsr339-experts] Re: [jax-rs-spec users] Are Links build with fromReosurce or fromResourceMethod are useful at all?

Santiago Pericas-Geertsen 11/16/2012

[jsr339-experts] Re: [jax-rs-spec users] Are Links build with fromReosurce or fromResourceMethod are useful at all?

Jan Algermissen 11/16/2012

[jsr339-experts] Re: [jax-rs-spec users] Re: Are Links build with fromReosurce or fromResourceMethod are useful at all?

Santiago Pericas-Geertsen 11/16/2012

[jsr339-experts] Re: [jax-rs-spec users] Re: Are Links build with fromReosurce or fromResourceMethod are useful at all?

Jan Algermissen 11/20/2012

[jsr339-experts] Re: [jax-rs-spec users] Re: Re: Are Links build with fromReosurce or fromResourceMethod are useful at all?

Santiago Pericas-Geertsen 11/26/2012

[jsr339-experts] Re: [jax-rs-spec users] Re: Re: Are Links build with fromReosurce or fromResourceMethod are useful at all?

Jan Algermissen 11/26/2012

[jsr339-experts] Re: [jax-rs-spec users] Re: Re: Re: Are Links build with fromReosurce or fromResourceMethod are useful at all?

Santiago Pericas-Geertsen 11/26/2012

[jsr339-experts] Re: [jax-rs-spec users] Re: Re: Re: Are Links build with fromReosurce or fromResourceMethod are useful at all?

Jan Algermissen 11/26/2012

[jsr339-experts] Re: [jax-rs-spec users] Re: Re: Re: Re: Are Links build with fromReosurce or fromResourceMethod are useful at all?

Santiago Pericas-Geertsen 11/26/2012

[jsr339-experts] Re: [jax-rs-spec users] Re: Re: Re: Re: Are Links build with fromReosurce or fromResourceMethod are useful at all?

Jan Algermissen 11/26/2012

[jsr339-experts] Re: [jax-rs-spec users] Re: Re: Re: Re: Re: Are Links build with fromReosurce or fromResourceMethod are useful at all?

Santiago Pericas-Geertsen 11/26/2012

[jsr339-experts] Re: [jax-rs-spec users] Re: Re: Re: Re: Re: Are Links build with fromReosurce or fromResourceMethod are useful at all?

Jan Algermissen 11/26/2012

[jsr339-experts] Re: [jax-rs-spec users] Re: Re: Re: Re: Re: Re: Are Links build with fromReosurce or fromResourceMethod are useful at all?

Santiago Pericas-Geertsen 11/27/2012

[jsr339-experts] Re: [jax-rs-spec users] Re: Re: Re: Re: Re: Re: Are Links build with fromReosurce or fromResourceMethod are useful at all?

Jan Algermissen 11/27/2012

[jsr339-experts] Re: [jax-rs-spec users] Re: Re: Re: Re: Re: Re: Re: Are Links build with fromReosurce or fromResourceMethod are useful at all?

Santiago Pericas-Geertsen 11/27/2012

[jsr339-experts] Re: [jax-rs-spec users] Re: Re: Re: Re: Re: Re: Re: Are Links build with fromReosurce or fromResourceMethod are useful at all?

Jan Algermissen 11/27/2012
 
 
Close
loading
Please Confirm
Close