users@jersey.java.net

Re: [Jersey] Efficient encoding of homogeneous arrays(tables)

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Wed, 1 Apr 2009 10:11:43 -0700

On Wed, Apr 1, 2009 at 8:52 AM, Markus Kohler <markus.kohler_at_gmail.com> wrote:
> Hi Paul,
> Thanks for you answer!
> Yes I thought about the solution to convert it to another bean, and yes I
> don't like the idea ;)
>
> Ideally I would think that one would just annotate a generic Collection to
> be homogeneous and then Jersey/JAXB would do the rest for me :)

Personally I think this is a transformation operation that does not
really belong in core JAX-RS.
Current data binding is geared towards data binding, with just minimal
tweaks (wrapping or not for xml lists etc), and no major structural
transformations. So this would be extension towards either specific
transformations, or more general transformation framework. I suspect
xslt for example could quite easily handle this.

But it also sounds like a contribution that would be useful for
others. And it might be something that could be made to work at Object
level (instead of format), thus being reusable with multiple formats.

Like Paul mentioned, MessageBodyWriter could be used to do these
transformations as part of output process; and MessageBodyReader for
doing reverse conversion when reading.

Also: if and when size is the concern, this is the case where
compression (gzip) is very very efficient and can mostly remove
redundancy. So gzip filter should solve sparseness, if that is the
main concern (which some CPU usage expense, i.e. it's likely to be bit
slower).

-+ Tatu +-