You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@wink.apache.org by srinivasan venkat <sr...@yahoo.com> on 2011/01/24 19:14:23 UTC

Content-Length Calculation in the Response object.

Hi,
I am setting the binary content to the response object.
It is an input Stream object to Response.entity(InputStream Object).
 
Does wink calculate the Content-Length after reading the entire Stream .
 
When I am using  the RestClient does the Content-Length will be provided in the Response Header by apache wink provider classes or Do i need to calculate the Content-Length in resource class and add to Response.entity(InputStream Object).header(Content-Length,size)
 
Thanks,
Srinivasan.V


Re: Content-Length Calculation in the Response object.

Posted by Bryant Luk <br...@gmail.com>.
Hello,

You will need to set the Content-Length header yourself in the server code.
 We do not read the entire InputStream and calculate the size.  Imagine if
that InputStream was 1GB of data;  we shouldn't buffer 1GB of data in memory
or anywhere else and we can't "unread" the InputStream.

On Mon, Jan 24, 2011 at 12:14 PM, srinivasan venkat <sr...@yahoo.com>wrote:

> Hi,
> I am setting the binary content to the response object.
> It is an input Stream object to Response.entity(InputStream Object).
>
> Does wink calculate the Content-Length after reading the entire Stream .
>
> When I am using  the RestClient does the Content-Length will be provided in
> the Response Header by apache wink provider classes or Do i need to
> calculate the Content-Length in resource class and add to
> Response.entity(InputStream Object).header(Content-Length,size)
>
> Thanks,
> Srinivasan.V
>
>