users@jersey.java.net

Re: [Jersey] XSL transform annotation and message body reader/writer

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 26 Nov 2009 10:49:26 +0100

Hi Robert,

Jersey does not currently have direct support for XSL transformations.

IIRC some developers have plugged into the input/output streams and
done transformations that way using request/response filters. Of
course this requires re-parsing of the XML.

The general problem is that there are a number of XML-based APIs
supported by Jersey, JAXB, SAX, StAX and DOM and developers can plug
in their own. Any "efficient" solution would require some intermediate
layer, perhaps at the level of SAX, say XML message body reader and
XML message body writer.

I would be include to declare transformation support as follows:

   @POST
   @Consumes("application/xml")
   @Produces("application/xml")
   @Transformation("myxstl.xsl")
   public MyJAXBBean post (
       @Transformation("myxstl.xsl") MyJAXBBean x) {
   }

It is definitely possible to do that with filters but as i said it
will require double parsing, but from the perspective of the
application that is an implementation detail.

Is this something you are interested in working on?

Paul.

On Nov 24, 2009, at 2:15 PM, Robert Koberg wrote:

> Hi,
>
> I tried searching around for:
>
> * an annotation for an XSL transform on an incoming request used
> before a resource method
> -- an option for using a tag balancing sax parser like tagsoup (http://home.ccil.org/~cowan/XML/tagsoup/
> ).
>
> * a message body reader/writer that transforms a jaxb request/result
> object
>
> Does anything like that exist?
>
> I think that the message body writer would be the most useful as it
> can output pretty much anything. The main problem being is that it
> would not be as fast as directly streaming the result.
>
> Any thoughts on this?
>
> best,
> -Rob
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>