users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Re: Re: get rid of getSize/Length

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Fri, 15 Jun 2012 11:51:22 +0100

Hi Santiago
On 04/06/12 15:38, Santiago Pericas-Geertsen wrote:
>
> On May 31, 2012, at 1:46 PM, Bill Burke wrote:
>
>>
>>
>> On 5/31/12 10:54 AM, Santiago Pericas-Geertsen wrote:
>>>
>>> On May 30, 2012, at 2:35 PM, Bill Burke wrote:
>>>
>>>> I'd like to get rid of or deprecate any getSize()/getLength() methods
>>>>
>>>> * MessageBodyWriter.getSize() should be deprecated and maybe have its language changed so that the value returned here is ignored, or at least, future implementations should always return -1. The reason for this is that the MBW should have full control on whether a Content-Length header is set or not and the JAX-RS runtime should not set this.
>>>
>>> So, is your suggestion that all MBW's set Content-Length in writeTo?
>>>
>>
>> Yes, if they can set it, set it.
>>
>> I fixed a bug a few months ago where our container set the Content-Length header based on MBW.getSize() and we had gzip encoding on, so the value Content-Length ended up being wrong.
>
> What if we state that JAX-RS implementations must not update Content-Length after calling writeTo()?
>

My only reservation about it is that there could be, in principle,
light-weight, JAX-RS centric containers which do not delegate say to
Tomcat or Jetty etc to set Content-Length.

Cheers, Sergey


> -- Santiago
>


-- 
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com