@Override
protected Element resolveRequestPayloadArgument(MethodParameter parameter, Source requestPayload) throws Exception {
if (requestPayload instanceof DOMSource) {
Node node = ((DOMSource) requestPayload).getNode();
DOMBuilder domBuilder = new DOMBuilder();
if (node.getNodeType() == Node.ELEMENT_NODE) {
return domBuilder.build((org.w3c.dom.Element) node);
}
else if (node.getNodeType() == Node.DOCUMENT_NODE) {
Document document = domBuilder.build((org.w3c.dom.Document) node);
return document.getRootElement();
}
}
// we have no other option than to transform
JDOMResult jdomResult = new JDOMResult();