Hi Casper,
you mean something like:
public interface XMLStreamOutput {
void write(XMLStreamWriter writer) throws XMLStreamException;
}
where Jersey would figure out the right writer to use,
based on the actual resource method @Produces types
and HTTP request headers?
~Jakub
On 03/22/2011 03:46 PM, Casper Bang wrote:
> Jersey's custom message body writers for JAXB beans is cool, but it
> suffers from two issues:
>
> 1) It requires a static model/projection to be typed, often making for
> these resource-dependent "shadow" hierarchies.
> 2) In case of large responses and/or responses with rolling latency
> (i.e. a database recordset), it can take long to start returning data.
>
> So I was wondering, would it be possible to generate StAX events and
> tie into Jersey's existing JAXB message body writers? Currently I am
> returning StreamingOutput from resources but it doesn't really let me
> reuse as much as Jersey as I want. To output both XML and JSON for
> instance, I need to implement two different resource methods with
> (slightly) different code emitting to the Stream.
>
> Seems like pluggable message body writers for StAX events would
> provide for some nice steaming support where the JAXB/POJO approach is
> too static or too slow/latent.
>
> /Casper