-
Feature Request
-
Resolution: Done
-
Major
-
7.20.0.Final
-
None
-
NEW
-
NEW
The Documents class, the class we use to store a collection of Document instances, can not be marshalled and unmarshalled with JAXB and JSON over the KIE-Server API (XStream does work). There seem to be multiple problems. The main issue is that Documents contains a List<Document>, where Document is an interface.
JAXB does not like interfaces, and hence won't marshall and/or unmarshall such an object.
The problem with JSON is that the JSON Marshaller won't work unless we register Documents and Document as extra remoteable classes. However, KIE-Server does not allow us to register interfaces as Remoteable classes, so this breaks as well.
What seems to be the solution is to:
- Add JAXB annotations to the List<Document> attribute of the Documents class. To be specific the annotations:
@XmlElementWrapper @XmlAnyElement(lax=true) private List<Document> documents = new ArrayList<>();
- Add the Documents class automatically to the "extraClasses" of the KieContainerInstance.
- Add the Document interface only to the extra class of the JSONMarshaller (as adding them to the JAXBContext will break JAXB. The idea is to do this via a KIE-Server JSONMarshaller extension.