List of usage examples for javax.mail Part toString
public String toString()
From source file:org.xmlactions.email.EMailParser.java
private void handlePart(Part part) throws MessagingException, IOException, DocumentException { log.debug("\n\n\nhandlePart ==>>"); log.debug("part.toString():" + part.toString()); log.debug(/*from ww w .j a va2 s . co m*/ "part.getContent():" + (part.getFileName() == null ? part.getContent().toString() : "Attachment")); log.debug("part.getContentType():" + part.getContentType()); log.debug("part.getFilename():" + part.getFileName()); log.debug("part.isAttachment:" + part.getFileName()); log.debug("part.isMessage:" + (part.getContent() instanceof Message)); Object obj = part.getContent(); if (obj instanceof Multipart) { Multipart mmp = (Multipart) obj; for (int i = 0; i < mmp.getCount(); i++) { Part bodyPart = mmp.getBodyPart(i); if (bodyPart instanceof Message) { setFirstMessageProcessed(true);// need to mark this when we // get a forwarded message // so we don't look for case // numbers in forwarded // emails. } handlePart(bodyPart); } } else if (obj instanceof Part) { if (obj instanceof Message) { setFirstMessageProcessed(true);// need to mark this when we get // a forwarded message so we // don't look for case numbers // in forwarded emails. } handlePart((Part) obj); } else { if (part instanceof MimeBodyPart) { MimeBodyPart p = (MimeBodyPart) part; Enumeration enumeration = p.getAllHeaders(); while (enumeration.hasMoreElements()) { Object e = enumeration.nextElement(); if (e == null) e = null; } Object content = p.getContent(); enumeration = p.getAllHeaderLines(); while (enumeration.hasMoreElements()) { Object e = enumeration.nextElement(); if (e == null) e = null; } DataHandler dh = p.getDataHandler(); if (dh == null) dh = null; } addPart(part); log.debug("=== Add Part ==="); log.debug((String) (part.getFileName() != null ? "isAttachment" : part.getContent())); // log.info("not recognised class:" + obj.getClass().getName() + // "\n" + obj); } log.debug("<<== handlePart"); }
From source file:org.xmlactions.email.EMailParser.java
private void showPart(Part part) throws IOException, MessagingException { log.info("\n\n\nshowPart ==>>"); log.info("part.toString():" + part.toString()); log.info("part.getContent():" + (part.getFileName() == null ? part.getContent().toString() : "Attachment")); log.info("part.getContentType():" + part.getContentType()); log.info("part.getFilename():" + part.getFileName()); log.info("part.isAttachment:" + part.getFileName()); log.info("part.isMessage:" + (part.getContent() instanceof Message)); Object obj = part.getContent(); if (obj instanceof Multipart) { log.info("MultiPart"); Multipart mmp = (Multipart) obj; for (int i = 0; i < mmp.getCount(); i++) { Part bodyPart = mmp.getBodyPart(i); showPart(bodyPart);/*from w w w . j a v a2s. c o m*/ } } else if (obj instanceof Part) { showPart((Part) obj); } else { log.info("=== Add Part ==="); log.info((String) (part.getFileName() != null ? "isAttachment" : part.getContent())); // log.info("not recognised class:" + obj.getClass().getName() + // "\n" + obj); } log.info("<<== showPart"); }