On May 10, 2009, at 4:31 PM, James Allchin wrote:
> Hi All,
>
> I am making some good progress with Jersey and really pleased with
> the framework.
>
> As I get into more detail one of the areas I am looking at if
> performance...
>
> I understand that Jersey is capable of returning StreamingOutput
> from a specific method call. I have tested this with a @GET method
> returning StreamingOutput.
>
Correct. Another approach is to implement a MessageBodyWriter.
> This will be important as sometimes we are returning a huge amount
> of XML and want Jersey to begin serving JAXB Beans as XML as soon as
> as they are created. Perhaps it is doing this anyway? (I may need to
> change the way in which I build the array of objects).
>
> However, is there anyway to make a method stream if we are returning
> an array of JAXB Bean (my own custom entities) - is this possible?
>
Do you want to avoid the creation of complete array of JAXB objects?
if not you can just return the array, Jersey will stream out the XML.
It just marshals out the JAXB objects directly to the output stream of
the HTTP container (e.g. the Servlet OutputStream) and does buffer the
complete XML document in memory before writing it out.
Paul.
> Apologies, if I have missed it in the docs...
>
> Cheers
>
> James