On 17 Oct 2013, at 00:16, Chun Tat David Chu <beyonddc.storage_at_gmail.com> wrote:
> Hi Marek,
>
> Thanks! That was very good information!
>
> May I suggest to include this piece of information documented in Ch 10 where it describes asynchronous services and clients in the Jersey documentation?
Thanks for the suggestion. Will do.
Marek
>
> Thanks,
>
> David
>
>
> On Wed, Oct 16, 2013 at 5:10 AM, Marek Potociar <marek.potociar_at_oracle.com> wrote:
> 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
>
>