use of org.apache.axiom.om.OMAttachmentAccessor in project webservices-axiom by apache.
the class BuilderSpec method from.
static BuilderSpec from(StAXParserConfiguration configuration, final MultipartBody message) {
Part rootPart = message.getRootPart();
InputSource is = new InputSource(rootPart.getInputStream(false));
is.setEncoding(rootPart.getContentType().getParameter("charset"));
BuilderSpec spec = create(configuration, is, false);
return new BuilderSpec(new FilteredXmlInput(spec.getInput(), new XOPDecodingFilter(new OMAttachmentAccessor() {
@Override
public DataHandler getDataHandler(String contentID) {
Part part = message.getPart(contentID);
return part == null ? null : part.getDataHandler();
}
})), new Detachable() {
@Override
public void detach() {
message.detach();
}
});
}
Aggregations