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

[jsr339-experts] Re: [jax-rs-spec users] Re: [Client API] Refactoring Link and Invocation

From: Santiago Pericas-Geertsen <Santiago.PericasGeertsen_at_oracle.com>
Date: Fri, 8 Jul 2011 09:50:56 -0400

On Jul 8, 2011, at 8:48 AM, Sergey Beryozkin wrote:

>>>> With your approach of Link *NOT* being a request factory, you'd have
>>>> to interact with the Client object.
>>>>
>>> OK, the fluent style involving Links looks good. That said
>>>
>>> Client.request(Link)
>>>
>>> needs to be there IMHO.
>>>
>>>
>>> One other problem with Link having factory methods is that it prevents
>>> it from being passed around. We have HttpRequest and Invocation.
>>> Invocation is invocable HttpRequest and I can see why API wants to
>>> prevent custom filters and such from doing invocations.
>>>
>> How can you not pass around a Link? A Link is not a request, its a glorified URI. Of course you can pass it around! At least with the current model.
>
> It's a factory->request, do you see any real difference between passing Invocation and factory of invocations around ?

 Filters and handlers operate on non-invocable HttpRequest's. We don't have a use case in which Link should be restricted in a similar manner. In fact, a non-invocable Link is much less convenient as an instance of Client would need to be passed around in case it needs to be invoked by another module. This is not unlike java.net.URL where URL.openStream() that can be used to open a connection and read from it.

-- Santiago