ChunkedOutput is Jersey-specific API. It lets you send "chunks" of data without closing the client connection using series of convenient calls to ChunkedOutput.write methods that take POJO + media type input and then will use the JAX-RS MessageBodyWriters to figure out the conversion of each POJO to bytes. ChunkedOutput writes are non-blocking.
StreamingOutput is a low level JAX-RS API that works with bytes directly. You have to implement StreamingOutput yourself and its write(OutputStream) method will be invoked only once by JAX-RS runtime and the call is blocking.
HTH,
Marek
On Oct 15, 2013, at 6:36 AM, Chun Tat David Chu <beyonddc.storage_at_gmail.com> wrote:
> Hi All,
>
> What are the differences between ChunkedOutput and StreamingOutput.
>
> It appears to me that ChunkedOutput is Jersey specific while StreamingOutput is part of JAX-RS API.
>
> I tried both mechanism to stream JSON objects using chunked encoding.
>
> Aside the usage of ChunkedOutput and StreamingOutput is a bit different but other than that it felt like both of them is very similar.
>
> Thoughts?
>
> Thanks!
>
> David