private Collection<Attachment> setupAttachmentOutput(SoapMessage message) { // We have attachments, so add the interceptor message.getInterceptorChain().add(attachOut); // We should probably come up with another property for this message.put(AttachmentOutInterceptor.WRITE_ATTACHMENTS, Boolean.TRUE); Collection<Attachment> atts = message.getAttachments(); if (atts == null) { atts = new ArrayList<>(); message.setAttachments(atts); } return atts; } }
@Override public void handleMessage(SoapMessage message) throws Fault { Map<?, ?> providedAttachments = (Map<?, ?>) message.getContextualProperty(ATTACHMENTS); if (providedAttachments.isEmpty()) { return; } Collection<Attachment> attachments = message.getAttachments(); if (attachments == null) { attachments = new ArrayList<>(); message.setAttachments(attachments); } for (Map.Entry<?, ?> entry : providedAttachments.entrySet()) { attachments.add(new AttachmentImpl((String)entry.getKey(), (DataHandler)entry.getValue())); } message.put(AttachmentOutInterceptor.WRITE_ATTACHMENTS, Boolean.TRUE); } }
private Collection<Attachment> setupAttachmentOutput(SoapMessage message) { // We have attachments, so add the interceptor message.getInterceptorChain().add(attachOut); // We should probably come up with another property for this message.put(AttachmentOutInterceptor.WRITE_ATTACHMENTS, Boolean.TRUE); Collection<Attachment> atts = message.getAttachments(); if (atts == null) { atts = new ArrayList<>(); message.setAttachments(atts); } return atts; } }
soapMessage.setAttachments(new ArrayList<Attachment>());
soapMessage.setAttachments(new ArrayList<Attachment>());
if (soapMessage.countAttachments() > 0) { if (message.getAttachments() == null) { message.setAttachments(new ArrayList<Attachment>(soapMessage .countAttachments()));
if (soapMessage.countAttachments() > 0) { if (message.getAttachments() == null) { message.setAttachments(new ArrayList<Attachment>(soapMessage .countAttachments()));