users@jersey.java.net

Re: [Jersey] entities encoding issues in the response

From: Arul Dhesiaseelan <arul_at_fluxcorp.com>
Date: Tue, 20 May 2008 13:54:19 -0600

Tatu,

Do you have any suggestion on this?

Appreciate your help.

Thanks!
Arul

Arul Dhesiaseelan wrote:
> Thanks Tatu for correcting me on this.
>
> But, CellType takes a string value which in this case is embedded
> within a CDATA. So, how do you expect me to set the CDATA string on
> the CellType within the resource class?
>
> Do I need to construct CDATASection?
>
> Please clarify.
>
> Thanks!
> Arul
>
>
> Tatu Saloranta wrote:
>> --- Arul Dhesiaseelan <arul_at_fluxcorp.com> wrote:
>>
>>
>>> Tatu,
>>>
>>> I have the CDATA set in my resource class.
>>>
>>
>> Ouch. This does indeed look wrong. Below does not make
>> sense -- you should never ever try to hand-generate
>> xml this way:
>>
>> ...
>>
>>> StringBuilder().append("<![CDATA[<div class=\"progressOuterRow\"><div
>>> class=\"progressInnerRow\" style=\"width:
>>>
>>>
>> ").append(result.toString()).append("px;\"></div><div
>>
>>>
>> class=\"progressText\">").append(used).append("/").append(total).append("
>>
>>
>> ...
>>
>>
>>> I assume this CDATA will be sent as a string to the
>>> XMLStreamWriter.writeCharacters() when the
>>> MessageBodyWriter<CellType> is invoked.
>>>
>>
>> Yes. And that's where double-escaping comes from.
>> Input has to be textual serialization; or
>> alternatively, write methods would have to parser and
>> re-serialize contents. But that sounds wrong
>> conceptually.
>>
>> -+ Tatu +-
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>>
>>