Пример #1
0
 private static Content getJoinedContent(MimePart part) throws IOException, MessagingException {
   Content result = new Content();
   MimeMultipart mp = (MimeMultipart) part.getContent();
   for (int i = 0; i < mp.getCount(); i++) {
     MimeBodyPart p = (MimeBodyPart) mp.getBodyPart(i);
     result.merge(processPart(p, part));
   }
   return result;
 }
Пример #2
0
 private static Content getContentWithAttachments(MimePart part)
     throws MessagingException, IOException {
   Content result = new Content();
   String rootId = new ContentType(part.getContentType()).getParameter("start");
   MimeMultipart mp = (MimeMultipart) part.getContent();
   for (int i = 0; i < mp.getCount(); i++) {
     MimePart p = (MimePart) mp.getBodyPart(i);
     if (isRootPart(p, i, rootId)) {
       result = result.merge(processPart(p, part));
     } else {
       result.attachments.add(p);
     }
   }
   return result;
 }
 public static void showImage(Long id) {
   Content content = Content.findById(id);
   notFoundIfNull(content);
   response.setContentTypeIfNotSet(content.image.type());
   File file = content.image.getFile();
   notFoundIfNull(file);
   renderBinary(file);
 }
 public static void showContents() {
   List<Content> contents = Content.findAll();
   render(contents);
 }
Пример #5
0
 private static Content getContent(MimePart part) throws IOException, MessagingException {
   Content result = new Content();
   result.body = (String) part.getContent();
   result.type = part.getContentType();
   return result;
 }