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

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

From: Santiago Pericas-Geertsen <Santiago.PericasGeertsen_at_oracle.com>
Date: Tue, 27 Nov 2012 09:14:14 -0500

On Nov 26, 2012, at 6:30 PM, Jan Algermissen <jan.algermissen_at_nordsc.com> wrote:

> You cannot *override* the resolution rules in the URI spec for relative URI references.
>
> I am honestly totally baffled about they way (you seem to) approach this issues. I looks as if you somehow assume to have control over the client to tamper with the resolution rules. If that is so, that would scare me.

 It's not even worth pursuing this discussion, I feel just as baffled at some of your responses; besides, the proposal has issues.

 The one thing we agree on is that we need to do something about these relative URIs, so let's move on that (hopefully without anyone getting scared :).

>
>
>> (don't know of any at the moment). Hence, my other proposal below ...
>>
>>>> The only other alternative that I can think of is to generate all the server URIs relative to the request URI.
>
> How would that work?

 One way could be to pass the request URI to the Link.Builder and ensure the links are relativized as part of the build process.

 Let's recap the options discussed so far:

 (i) Use @BaseUri on Application subclass.

     + straightforward semantics
     + easy to implement
     - requires re-compilation to change base URI
     - may be only reason to define an Application subclass

 As stated before, I think this solution would be better if we had a DD. But, perhaps this is something we can go with now and improve if when/if we introduce a DD?

 (ii) Compute relative URIs based on request URIs

     + no need to specify base URI
     - harder to implement
     - links in responses need a context (base URI) for resolution

-- Santiago