if (cls == genericType) {
genericType = actualClass;
}
Marshaller ms = createMarshaller(actualObject, actualClass, genericType, m);
XMLOutputFactory factory = new MappedXMLOutputFactory(namespaceMap);
XMLStreamWriter xsw = factory.createXMLStreamWriter(os);
ms.marshal(actualObject, xsw);
xsw.close();
} catch (JAXBException e) {
throw new WebApplicationException(e);