Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your problem is that the default serialization strategy (use JAXB) means that you can't serialize that map directly. There are two main ways to deal with this.</p> <h2>Write an <code>XmlAdaptor</code></h2> <p>There are a number of questions on this on SO but the nicest explanation I've seen so far is <a href="http://www.mail-archive.com/cxf-user@incubator.apache.org/msg04723.html" rel="nofollow">on the CXF users mailing list</a> from a few years ago. The one tricky bit (since you don't want an extra wrapper element) is that once you've got yourself a type adaptor, you've got to install it using a <a href="http://jaxb.java.net/nonav/2.1/docs/api/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapter.html" rel="nofollow">package-level annotation</a> (on the right package, which might take some effort to figure out). Those are relatively exotic.</p> <h2>Write a custom <code>MessageBodyWriter</code></h2> <p>It might well be easier to write your own code to do the serialization. To do this, you implement <a href="http://jackson.codehaus.org/javadoc/jax-rs/1.0/javax/ws/rs/ext/MessageBodyWriter.html" rel="nofollow"><code>javax.ws.rs.ext.MessageBodyWriter</code></a> and tag it with <code>@Provider</code> (assuming that you are using an engine that uses that to manage registration; not all do for complex reasons that don't matter too much here). This will let you produce <em>exactly</em> the document you want from any arbitrary type at a cost of more complexity when writing (but at least you won't be having complex JAXB problems). There are many ways to actually generate XML, with which ones to choose between depending on the data to be serialized</p> <p>Note that if you were streaming the data out rather than assembling everything in memory, you'd <em>have</em> to implement this interface.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload