users@jersey.java.net

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

From: Robert Koberg <rob.koberg_at_gmail.com>
Date: Fri, 27 Nov 2009 07:00:10 -0800

On Nov 26, 2009, at 1:49 AM, Paul Sandoz wrote:

> 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?


Sorry for the late response. Was traveling Wed and the internet was unavailable till yesterday afternoon.


Yes. I will need a transform. I was hoping to get to something this weekend, but it doesn't look likely.

best,
-Rob


>
> 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
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>