users@jax-rs-spec.java.net

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

From: Santiago Pericas-Geertsen <Santiago.PericasGeertsen_at_oracle.com>
Date: Mon, 26 Nov 2012 10:38:57 -0500

On Nov 20, 2012, at 4:14 PM, Jan Algermissen <jan.algermissen_at_nordsc.com> wrote:

>
> On Nov 16, 2012, at 11:11 PM, Santiago Pericas-Geertsen <Santiago.PericasGeertsen_at_oracle.com> wrote:
>
>>
>> On Nov 16, 2012, at 4:46 PM, Jan Algermissen <jan.algermissen_at_nordsc.com> wrote:
>>
>>>
>>> On Nov 16, 2012, at 10:40 PM, Santiago Pericas-Geertsen <Santiago.PericasGeertsen_at_oracle.com> 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?

-- Santiago