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

[jsr339-experts] Re: [jax-rs-spec users] Re: Hypermedia - Take 2

From: Markus KARG <markus_at_headcrashing.eu>
Date: Tue, 26 Jul 2011 19:57:12 +0200

> Re-inforcing Sergey's point in different terms, the browser can do
> this because the next request is always associated with the last
> response. The Client API allows you to break this association, so it's
> not always possible to absolutize your links in the same manner.
>
> For example,
>
> Client c = .
> Order o = c.request(".").get().invoke(Order.class);
>
> // Execute some other requests using "c" .
>
> // How is the relative o.getCustomer() URI resolved here?
> Customer cust =
> c.request(o.getCustomer()).get().invoke(Customer.class);
>
> We would need to use HttpResponse, and somehow create the next request
> based on that object for this to work. Using absolute links by default
> seems like the better option. It may be possible to handle this
> scenario better in a high-level API.

Again, please check my original proposal which said that I do not keep any
URIs but return JAXB types. That means, the first above invoke returns a
Order and that Order has a Customer (not an URI -- this is already
resolved). So a o.getCustomer() returns a customer which is already loaded
*before* you obtain the Order. You never get that URI of the customer in my
proposal. So the second invocation is not needed.

Regards
Markus