Hi,

according to an older post from Daniel, it should be possible to implement full 
streaming by
implementing the interface "Provider<StaxSource>".

I got a small sample service up and running and CXF is dispatching the call 
into my "invoke" method.
With this service I would like to return a very large response which is the 
result of a JDBC query.

However, I am a little bit lost in the XML APIs. I have to return an instance 
of "StaxSource" to
CXF. "StaxSource" requires an instance of "XMLStreamReader" in its constructor, 
and
"XMLStreamReader" is a very, very low level XML (pull) API.

Is it somehow possible to make "XMLStreamReader" work with objects? Is there 
some kind of "bridge"
that I can insert between my objects and "XMLStreamReader", to have a little 
bit more comfort?

My object graph is very simple: Object "A" contains (aggregation) some tiny 
"B"s. So it would be no
problem to construct one "A" in memory and insert all the nested "B"s in 
memory. Then I would like
to give this "A" to CXF/XMLStreamReader for serialization and I would construct 
the next "A" in memory.

Unfortunately, I cannot find such a "bridge". I took a look at XStream. With its
"xstream.createObjectOutputStream()" and "objectOutputStream.writeObject(a)" I 
would have the above
semantics of constructing one "A" in memory and serializing one "A" after 
another. But I did not
find any possibility to put XStream and XMLStreamReader together.

Do you have any hints for me? Are there any other solutions to stream small 
chunks of the result to
the client - chunk by chunk? Without using this low level XMLStreamReader?


Regards,
Martin

Reply via email to