RE: [Jersey] using jaxb to stream a large data set

From: Moiz Dohadwala <>
Date: Tue, 9 Feb 2010 09:44:55 -0800


Thanks. I was leading that way myself. My concern regarding using jaxb fragments for streaming was the ability to marshal to json seamlessly. I guess I will find out.


-----Original Message-----
From: Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
Sent: Tuesday, February 09, 2010 9:06 AM
Subject: Re: [Jersey] using jaxb to stream a large data set

On Feb 9, 2010, at 1:15 AM, Moiz Dohadwala wrote:

> Hello,
> We am currently using jersey to build a set of reports. The reports
> on the UI are paginated, since the data set can potentially be very
> large. However, we need to provide a download option to allow the
> user to download the entire set. Currently we have been using jaxb
> to provide support for xml as well as json. What options to we have
> to support streaming streaming using jaxb in jersey?

JAXB is not a streaming-based API so i guess any approach would be to
utilize "fragments" of JAXB.

The only current support for fragments of JAXB is returning a List<T>
or Collection<T> (and it would be really easy to extend to support

You could implement a Collection that supports a lazy iterator.

Alternatively you could implement the JAXB fragment marshaling
yourself using StreamingOutput [1].



To unsubscribe, e-mail:
For additional commands, e-mail: