users@grizzly.java.net

Re: Weird issue with HTTP download sample.

From: Oleksiy Stashok <oleksiy.stashok_at_oracle.com>
Date: Tue, 06 Jan 2015 18:14:49 -0800

Hi Dan,

On 06.01.15 17:47, Daniel Feist wrote:
> Hi,
>
> I've found what I think is something wierd going on with the http
> download example included in the source tree. If you run it with a
> payload larger than chunk size of 1KB then and compare the source file
> (read by Server), and the target file (saved to disk by the Client)
> they are not the same. The file recieved has some content but then is
> nearly all 0's. I've tried this with a number of different payload
> sizes and see rougly the same. I'm still looking into the root
> cause, I'll let you know what I find, but it would be interesting to
> see if anyone else has seen this before or has any thoughts on where
> to look.
which exactly sample did you try?

> Is this the recommended approach for sending chunked responses with
> Grizzly? Or rather should org.glassfish.grizzly.http.io.OutputBuffer
> be used somehow?
If you use HttpServer API along with Response.getOutputStream() - it
should take care of the chunking. If the response is smaller than output
buffer size - it'll be sent using Content-Length, if the response is
larger or outputStream.flush() is explicitly called - the chinking
encoding will be used.

WBR,
Alexey.

>
> thanks,
> Dan