List of usage examples for javax.xml.soap AttachmentPart addMimeHeader
public abstract void addMimeHeader(String name, String value);
From source file:com.googlecode.ddom.saaj.SOAPMessageTest.java
@Validated @Test//from w w w.ja v a 2 s . co m public void testGetAttachmentsFiltered() throws Exception { SOAPMessage message = getFactory().createMessage(); AttachmentPart att1 = message.createAttachmentPart(); att1.addMimeHeader("Content-Type", "text/plain"); message.addAttachmentPart(att1); AttachmentPart att2 = message.createAttachmentPart(); att2.addMimeHeader("Content-Type", "application/octet-stream"); message.addAttachmentPart(att2); AttachmentPart att3 = message.createAttachmentPart(); att3.addMimeHeader("Content-ID", "<123456@example.com>"); att3.addMimeHeader("Content-Type", "text/plain"); message.addAttachmentPart(att3); MimeHeaders headers = new MimeHeaders(); headers.addHeader("Content-Type", "text/plain"); Iterator it = message.getAttachments(headers); assertTrue(it.hasNext()); assertSame(att1, it.next()); assertTrue(it.hasNext()); assertSame(att3, it.next()); assertFalse(it.hasNext()); }