Class<?> parameterType = parameter.getParameterType();
if (parameterType.isAssignableFrom(requestPayload.getClass())) {
return requestPayload;
}
if (DOMSource.class.isAssignableFrom(parameterType)) {
DOMResult domResult = new DOMResult();
transform(requestPayload, domResult);
Node node = domResult.getNode();
if (node.getNodeType() == Node.DOCUMENT_NODE) {
return new DOMSource(((Document) node).getDocumentElement());
}
else {
return new DOMSource(domResult.getNode());
}
}
else if (SAXSource.class.isAssignableFrom(parameterType)) {
ByteArrayInputStream bis = convertToByteArrayInputStream(requestPayload);
InputSource inputSource = new InputSource(bis);