users@jersey.java.net

Re: [Jersey] entities encoding issues in the response

From: Tatu Saloranta <cowtowncoder_at_yahoo.com>
Date: Thu, 15 May 2008 14:28:38 -0700 (PDT)

--- Paul Sandoz <Paul.Sandoz_at_Sun.COM> wrote:

> Hi Arul,
>
> The write to method is not going to serialize out
> any XML. It is just
> going to serialize out the String "value" as UTF-8
> encoded characters.
>
> In the writeTo method you need to use JAXB
> marshalling on the CellType
> object. And you need to use the Apache XML
> serializer [1] or wrapping
> the XMLStreamWriter as recommended by Tatu. I think
> the latter is easier.
>
> Tatu, is there a helper class in Woodstox for
> XMLStreamWriter that is
> the equivalent of
> javax.xml.stream.util.StreamReaderDelegate ?

Unfortunately Stax (JSR-173) does not have a
StreamWriterDelegate. This must be an oversight, but
for some reason writer-side is missing many things one
would expect. ;-/

Perhaps this could be added to stax-utils (stax
project however? Come to think of it, it might already
have it:

https://stax-utils.dev.java.net/

In addition, I just filed a feature request for
Woodstox 4.0 to add equivalent. But there is no such
delegate yet, so on short term that wouldn't help.

-+ Tatu +-