users@jersey.java.net

Re: [Jersey] MessageBodyWriter Example for XML

From: Moises Lejter <moilejter_at_gmail.com>
Date: Tue, 23 Mar 2010 15:42:39 -0500

The simplest thing for you to do might be to return a DocumentSource with your Document in it, rather than returning the Document itself ... (I think JAX-RS knows about SAX sources, and I think that is what a DocumentSource is ...)

Moises

On Mar 23, 2010, at 2:58 PM, Jay_K wrote:

>
> I am trying to generate and return an XML using below class
>
> @Path("/portaldetails")
> public class PortalResource {
> @GET
> @Produces({MediaType.APPLICATION_XML})
> public Document getLeaveDetails(@QueryParam("portalId") String portalId) {
>
> Few steps to generate XML document using Dom4J
> return portalXMLDoc;
> }
> }
> I am getting below exception
>
> [3/23/10 15:52:19:982 EDT] 00000023 ContainerResp E A message body writer
> for Java type, class org.dom4j.tree.DefaultDocument, and MIME media type,
> application/xml, was not found
>
> Could anyone, please provide me either a sample class implementing
> MessageBodyWriter for above scenario or any material to get details about
> the same.
> Thanks for the help.
> --
> View this message in context: http://n2.nabble.com/MessageBodyWriter-Example-for-XML-tp4786769p4786769.html
> Sent from the Jersey mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>