I have legacy code that implements org.springframework.oxm.mimeMimeUnmarshaller
:
import javax.xml.bind.attachment.AttachmentUnmarshaller;
import javax.xml.transform.Source;
import org.springframework.oxm.UnmarshallingFailureException;
import org.springframework.oxm.XmlMappingException;
import org.springframework.oxm.mime.MimeContainer;
import org.springframework.oxm.mime.MimeUnmarshaller;
import org.springframework.xml.transform.StaxSource;
public class MISMarshaller implements MimeUnmarshaller {
.
.
.
public Object unmarshal(Source source, MimeContainer mimeContainer) throws XmlMappingException {
AttachmentUnmarshaller au = null;
if (this.mtomEnabled && mimeContainer != null) {
au = new MISMarshaller.MISAttachmentUnmarshaller(mimeContainer);
}
if (source instanceof StaxSource && ((StaxSource)source).getXMLStreamReader() != null) {
try {
return this.context.unmarshal(au, ((StaxSource)source).getXMLStreamReader());
} catch (Exception var5) {
throw new UnmarshallingFailureException(var5.getMessage(), var5);
}
} else {
throw new IllegalStateException(
"Only StAX is supported for MIS marshaller. Use AXIOM message factory.");
}
}
.
.
.
}
I am upgrading this code to Spring 5 and the class StaxSource
is not in Spring 5. How can this be rewritten to work for Spring 5?