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

[jsr339-experts] Re: FWIW

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Fri, 26 Aug 2011 17:44:58 +0100

My apologies for being lazy :-), looks nice.
However still unhappy about Invocations and such, but not in a bad mood
now, just in time for weekends :-)

Cheers, Sergey

On 26/08/11 17:42, Marek Potociar wrote:
> On 08/26/2011 06:27 PM, Sergey Beryozkin wrote:
>> On 26/08/11 17:19, Markus KARG wrote:
>>>> Markus, Sergey: I have reintroduced the target.request(), you didn't
>>>> like. However I tried to do it in a way that does
>>>> not bring any extra method into the invocation chain. Instead of:
>>>>
>>>> client.target().accept("text/plain").get();
>>>>
>>>> You can now write:
>>>>
>>>> client.target().request("text/plain").get();
>>>
>>> Actually I do not see why it is necessary to *rename* the method. Obviously it still is used to pass in the accept
>>> header, so why not still name it accept, independent of what it actually does or produce?
>>>
>>
>> how does it work now for post() with Congtent-Type ?
>
> Entity headers are specified as part of the entity, using one of the Entity.* static methods:
>
> client.target(...).request().put(Entity.text("Hi"));
> client.target(...).request().put(Entity.xml(customer));
> client.target(...).request().put(Entity.entity("Hi", "text/plain"));
> client.target(...).request().put(Entity.entity("Hi", new Variant("text/plain", Locale.ENGLISH, "gzip")));
>
> With static import of Entity, this reduces to:
>
> client.target(...).request().put(text("Hi"));
> client.target(...).request().put(xml(customer));
> client.target(...).request().put(entity("Hi", "text/plain"));
> client.target(...).request().put(entity("Hi", new Variant("text/plain", Locale.ENGLISH, "gzip")));
>
> Marek
>
>
>>
>> Sergey
>>
>>
>>>> In the fluent interface I prefer async().put() over putAsync() or
>>>> asyncPut().
>>>
>>> Me, too.
>>>
>>> Regards
>>>
>>>
>>
>>


-- 
Sergey Beryozkin
http://sberyozkin.blogspot.com
Talend - http://www.talend.com