users@jax-rs-spec.java.net

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

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Thu, 31 May 2012 09:02:18 +0100

On 30/05/12 19:35, 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.

The only time I recall setting MBW to return a specific value in
getSize() was when it was byte[]; perhaps it can be set to something
specific when dealing with Ranges.
I agree in most cases it's of no use, MBW can always set Content-Length
when really needed

>
> * ClientRequestContext.getLength() should be removed. Users will not
> (and should not) be setting a Content-Length header. Also, usually this
> value will never be known within a filter/interceptor invocation.
>
I guess the story here is the same as with byte[] and MBW
>
>

Cheers, Sergey