}
Marshaller ms = createMarshaller(actualObject, actualClass, genericType, encoding);
Configuration c = new Configuration(namespaceMap);
MappedNamespaceConvention convention = new MappedNamespaceConvention(c);
AbstractXMLStreamWriter xsw = new MappedXMLStreamWriter(
convention,
new OutputStreamWriter(os, encoding));
if (serializeAsArray) {
if (arrayKeys != null) {
for (String key : arrayKeys) {
xsw.seriliazeAsArray(key);
}
} else {
String key = getKey(convention, cls);
xsw.seriliazeAsArray(key);
}
}
ms.marshal(actualObject, xsw);
xsw.close();
} catch (JAXBException e) {
handleJAXBException(e);
} catch (XMLStreamException e) {
throw new WebApplicationException(e);