&& dh.getContent() instanceof Source) { dh = new DataHandler(createDataSource((Source)dh.getContent(), ct));
public Object getContent() throws IOException { return parent.getContent(); }
try { o = dh.getContent(); } catch (IOException e) { throw new Fault(e);
Object c; try { c = getDataHandler().getContent(); } catch (FolderClosedIOException fex) { throw new FolderClosedException(fex.getFolder(), fex.getMessage());
MimeBodyPart mbp = (MimeBodyPart)part; o = mbp.cachedContent != null ? mbp.cachedContent : dh.getContent(); } else if (part instanceof MimeMessage) { MimeMessage msg = (MimeMessage)part; o = msg.cachedContent != null ? msg.cachedContent : dh.getContent(); } else o = dh.getContent(); if (o instanceof MimeMultipart) ((MimeMultipart)o).updateHeaders();
Object c; try { c = getDataHandler().getContent(); } catch (FolderClosedIOException fex) { throw new FolderClosedException(fex.getFolder(), fex.getMessage());
MimeBodyPart mbp = (MimeBodyPart)part; o = mbp.cachedContent != null ? mbp.cachedContent : dh.getContent(); } else if (part instanceof MimeMessage) { MimeMessage msg = (MimeMessage)part; o = msg.cachedContent != null ? msg.cachedContent : dh.getContent(); } else o = dh.getContent(); if (o instanceof MimeMultipart) ((MimeMultipart)o).updateHeaders();
Object c; try { c = getDataHandler().getContent(); } catch (FolderClosedIOException fex) { throw new FolderClosedException(fex.getFolder(), fex.getMessage());
Object c; try { c = getDataHandler().getContent(); } catch (FolderClosedIOException fex) { throw new FolderClosedException(fex.getFolder(), fex.getMessage());
public Object getContent() throws MessagingException, IOException { return getDataHandler().getContent(); }
public Object getContent() throws MessagingException, IOException { return getDataHandler().getContent(); }
public Object getContent() throws MessagingException, IOException { return getDataHandler().getContent(); }
public Object getContent() throws MessagingException, IOException { return getDataHandler().getContent(); }
private void process(String fn) throws IOException { DataSource ds = new FileDataSource(fn); DataHandler dh = new DataHandler(ds); DataHandler.setDataContentHandlerFactory(new MyDataContentHandlerFactory()); Object data = dh.getContent(); System.out.println("Content=" + data); if (data != null) System.out.println("Type =" + data.getClass().getName()); } }
private Message extractAttachment(Message inMessage, String attachmentName) throws Exception { final Message outMessage = new DefaultMessage(inMessage.getExchange().getContext()); outMessage.setHeader(HEADER_NAME, attachmentName); Object attachment = inMessage.getAttachment(attachmentName).getContent(); if (attachment instanceof InputStream) { outMessage.setBody(readMimePart((InputStream) attachment)); return outMessage; } else if (attachment instanceof String || attachment instanceof byte[]) { outMessage.setBody(attachment); return outMessage; } else { return null; } }
public Object getContent() throws SOAPException { if (dataHandler == null) throw new SOAPException(BundleUtils.getMessage(bundle, "NO_CONTENT_AVAILABLE")); try { return dataHandler.getContent(); } catch (IOException e) { throw new SOAPException(e); } }
Folder inbox = store.getFolder("Inbox"); inbox.open(Folder.READ_WRITE); DataHandler dataHandler = message.getDataHandler(); MimeMultipart mimeMultipart = (MimeMultipart) dataHandler.getContent(); for (int k = 0; k < mimeMultipart.getCount(); k++) { BodyPart bodyPart = mimeMultipart.getBodyPart(k); }
public void startElement(String namespace, String localName, String prefix, Attributes attributes, DeserializationContext context) throws SAXException { super.startElement(namespace, localName, prefix, attributes, context); if (getValue() instanceof DataHandler) { try { DataHandler dh = (DataHandler) getValue(); setValue(dh.getContent()); } catch (IOException ioe) { } } } // startElement } // class PlainTextDataHandlerDeserializer
public void startElement(String namespace, String localName, String prefix, Attributes attributes, DeserializationContext context) throws SAXException { super.startElement(namespace, localName, prefix, attributes, context); if (getValue() instanceof DataHandler) { try { DataHandler dh = (DataHandler) getValue(); setValue(dh.getContent()); } catch (IOException ioe) { } } } // startElement } // class PlainTextDataHandlerDeserializer
public void testClonePartiallyWithAttachments() throws Exception { MessageContext origMc = new MessageContext(); String contentId = origMc.addAttachment(new DataHandler("test", "text/html")); MessageContext newMc = MessageHelper.clonePartially(origMc); DataHandler dh = newMc.getAttachment(contentId); assertNotNull(dh); assertEquals("test", dh.getContent()); }