Details
-
Bug
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
3.0.1
-
Platform Sprint 139
Description
If you enable manual rest services using Essentials REST Services Setup tool in Hippo v11, then you will probably use the HippoHtmlAdapter as XmlJavaTypeAdapter as expected for HippoHtml getter method:
@XmlJavaTypeAdapter(HippoHtmlAdapter.class) @XmlElement @HippoEssentialsGenerated(internalName = "myhippoproject:content") public HippoHtml getContent() { // ... }
The problem is, the content is generated like the following if you see the raw output:
$ curl -v http://localhost:8080/site/rest/events/2016/08/breakfast?_type=xml * Trying ::1... * Connected to localhost (::1) port 8080 (#0) > GET /site/rest/events/2016/08/breakfast?_type=xml HTTP/1.1 > Host: localhost:8080 > User-Agent: curl/7.43.0 > Accept: */* > < HTTP/1.1 200 OK < Server: Apache-Coyote/1.1 < Date: Tue, 30 Aug 2016 17:19:51 GMT < Content-Type: application/xml;charset=UTF-8 < Content-Length: 818 < <?xml version="1.0" encoding="UTF-8" standalone="yes"?><eventsdocument><content><![CDATA[ <p>Breakfast is served starting from 8:00 until 9:30.</p> * Connection #0 to host localhost left intact ]]></content><date>2013-11-12T08:00:00+01:00</date><endDate>2017-08-14T19:20:00-04:00</endDate><image><displayName>coffee-206142_150.jpg</displayName><leaf>false</leaf><localizedName>coffee-206142_150.jpg</localizedName><name>coffee-206142_150.jpg</name><path>/content/gallery/myhippoproject/samples/coffee-206142_150.jpg/coffee-206142_150.jpg</path><primaryNodeTypeName>hippogallery:imageset</primaryNodeTypeName><blank>false</blank><length>0</length><height>0</height><width>0</width></image><introduction>Start the day with a nice breakfast.</introduction><location>Room 101</location><title>Breakfast</title></eventsdocument>
It should have been either:
<content><![CDATA[ <p>Breakfast is served starting from 8:00 until 9:30.</p> * Connection #0 to host localhost left intact ]]></content>
or
<content> <p>Breakfast is served starting from 8:00 until 9:30.</p> * Connection #0 to host localhost left intact </content>
That is, if you use CDATA, then don't encode CDATA itself and do not encode its content. Otherwise don't use CDATA.
Even worse, this makes a functional problem as well. If you get the text content of the <content>> node, it will contain "<![CDATA[...]]>" literal as well, which is not acceptable. Also, if you get the response as JSON instead (e.g, using _type=json), you will get the literal as well. What's the point?
Attachments
Issue Links
- is backported by
-
ESSCOM-10 [backport 11.0] HippoHtmlAdapter marshals string in wrong CDATA section
- Closed