users@jersey.java.net

[Jersey] Re: URI generated with &

From: Noah White <emailnbw_at_gmail.com>
Date: Sat, 23 Feb 2013 11:47:01 -0500

It's is being escaped because it is an XML predefined entity and if it were left as a raw & it would break XML parsing/marshalling of it.

If you use the MOXy JAXB provider you might try adding the @XmlCDATA annotation to have it placed in a !<[[CDATA]]> section which should leave it unescaped.

See this [1] for details.

-Noah

[1] - http://blog.bdoughan.com/2010/07/cdata-cdata-run-run-data-run.html

On Feb 23, 2013, at 2:24 AM, D'Arcy Smith <ds_at_terratap.com> wrote:

> Hi all,
> With an element in a response like:
>
> @XmlElement
> private URI x;
> I get a resulting XML/JSON like this:
>
> <x>http://localhost:8080/y/31/z?a=1&amp;b=2</x>
> Is there a way to have it without the amp;, like this:
>
> <x>http://localhost:8080/y/31/z?a=1&b=2</x>
> Thanks,
> ..darcy