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

[jsr339-experts] Re: [jax-rs-spec users] Re: client revisions

From: Santiago Pericas-Geertsen <Santiago.PericasGeertsen_at_oracle.com>
Date: Wed, 24 Aug 2011 09:11:40 -0400

On Aug 23, 2011, at 2:28 PM, Bill Burke wrote:

>>>
>>> I also think there are a lot of problems with it:
>>>
>>> * How do you set the Content-Type of a Target? What I'm getting at is, what's the point of having Target implement the
>>> SyncInvoker interface?
>>
>> Content type SHOULD be included when entity is not empty, but it is not a mandatory header. You can include it via:
>> client.target(...).type("text/plain").put(entity);
>>
>> Or you can just omit it (not recommended):
>> client.target(...).put(entity); // content type defaults to "application/octet-stream"
>>
>> Other option would be to add an extra parameter for content-type into the invoker methods that consume entity (PUT, POST
>> ...). But we discussed this with Santiago and we feel that the extra parameter would make the method signatures somewhat
>> complex.
>>
>> Yet another option would be to provide some default content type resolution support for most common entity types.
>>
>
> All this just so that you don't have to invoke a request() method (which is fluent-compliant BTW) on Target. IMO, which I've stated in the past, a request() method makes a clear separation of concerns.

 +1. I like the explicit transition provided by a request() method on Target.

-- Santiago