users@jersey.java.net

Re: [Jersey] Streaming Output

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Thu, 29 Jul 2010 10:21:36 -0700

On Thu, Jul 29, 2010 at 5:42 AM, Paul Sandoz <Paul.Sandoz_at_oracle.com> wrote:
>
> On Jul 28, 2010, at 3:22 PM, Herak Sen wrote:
>
> Hi All,
>
> What is the best way to stream output using Jersey?
> e.g. A resource generating multiple media type such as pdf, xls etc.
>
>
> You can use an instance of StreamingOutput [1] for the entity, which may be
> easier than developing your own MessageBodyWriter.
> Paul.

+1. StreamingOutput is for some reason an unknown gem for most Jersey
developers... it should be about first thing to learn after basic
annotations. :-)
Maybe it's just that name is not entirely intuitive; although it does
allow streaming, that's not the only use case. Rather it just gives
more flexibility and control for web app with respect to serialization
aspects.

-+ Tatu +-