List<org.apache.cxf.message.Attachment> atts =
new ArrayList<org.apache.cxf.message.Attachment>();
for (int i = 1; i < handlers.size(); i++) {
Attachment handler = (Attachment)handlers.get(i);
AttachmentImpl att = new AttachmentImpl(handler.getContentId(), handler.getDataHandler());
for (String key : handler.getHeaders().keySet()) {
att.setHeader(key, att.getHeader(key));
}
att.setXOP(false);
atts.add(att);
}
Message outMessage = getOutMessage();
outMessage.setAttachments(atts);
outMessage.put(AttachmentOutInterceptor.WRITE_ATTACHMENTS, "true");