users@jersey.java.net

Re: Insert processing instructions

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 09 Apr 2008 12:33:05 +0200

Wilfred Springer wrote:
> Hi Paul,
>
> Yes, I was thinking about using this in combination with JAXB. However,
> I would rather have a dedicated stylesheet for all document types I am
> returning.
>
> Now, I already figured it could be done by implementing your own
> MessageBodyWriter. I just don't know how too plug it in.
>

Please see the EntityProvider example in the Jersey distribution. You
annotate your reader/writer using @Provider and the class scanning stuff
will pick it up just like for root resource classes.


> (Eh, but I have to admit, I didn't read the spec all that carefully. :-p)
>
>
> Another way to do this without creating your own Java type for a
> representation is to wrap a JAXBContext to modify the marshaller. I
> can send more info on this if you like.
>
>
> I'd be interested to learn more about that. From the looks of it, I
> guess it assumes that you directly interact with the Jersey
> implementation, right?

It is part of the 311 spec. And works like other providers in the way
you register it, annotate with @Provider. I will send out more details
later this week.

Paul.

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109