users@jersey.java.net

Re: using jaxb to stream a large data set

From: bmraczk <bmraczk_at_verizon.net>
Date: Tue, 10 Aug 2010 07:52:41 -0700 (PDT)

We are dealing with a large data set around 3g 4million records. Any ideas
would help. I am relatively new to jersey
 This is my third application.

Sent via DROID on Verizon Wireless

-----Original message-----
From: "Paul Sandoz-2 [via Jersey]"
<ml-node+5393244-1008213932-73299_at_n2.nabble.com>
To: bmraczk <bmraczk_at_verizon.net>
Sent: Tue, Aug 10, 2010 14:21:34 GMT+00:00
Subject: Re: using jaxb to stream a large data set





On Aug 10, 2010, at 3:42 PM, bmraczk wrote:

>
> Is there an example of using streaming xml in jersey
>

There is no example with JAXB. Do you want to manage the unmarshalling
of a large XML document in chunks binding sub-elements to a JAXB beans?

If so it is possible with StAX, but i just realized we have an
oversight in Jersey and it is not possible to inject an XmlStreamReader.

But you can do this:

    ...

    @POST
    pubiic .... post(InputStream in, @Context
Injectable<XMLInputFactory> xif) {

       XMLStreamReader r = xif.getValue().createXMLStreamReader(in);

       // loop through reader and marshall sub parts to JAXB beans
    }


For marshalling it should be possible to do something similar
XMLStreamWriter in conjunction with JAXB marshalling and
StreamingOutput [1]. Just make sure you set the fragment property of
the marshaller to true

Paul.

[1]
https://jsr311.dev.java.net/nonav/releases/1.1/javax/ws/rs/core/StreamingOutp
ut.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
For additional commands, e-mail: users-help_at_jersey.dev.java.net



______________________________________
View message @
http://jersey.576304.n2.nabble.com/using-jaxb-to-stream-a-large-data-set-tp45
38063p5393244.html

To unsubscribe from Re: using jaxb to stream a large data set, click
http://jersey.576304.n2.nabble.com/template/NodeServlet.jtp?tpl=unsubscribe_b
y_code&node=5393095&code=Ym1yYWN6a0B2ZXJpem9uLm5ldHw1MzkzMDk1fC0xNTk3MDc3NTA0




-- 
View this message in context: http://jersey.576304.n2.nabble.com/using-jaxb-to-stream-a-large-data-set-tp4538063p5393370.html
Sent from the Jersey mailing list archive at Nabble.com.