Class MultipartMimeUtils


  • public class MultipartMimeUtils
    extends Object
    MultipartMimeUtils is a collection of static utility clases that facilitate the parsing of multipart/form-data and multipart/mixed requests using the MimeMultipart class provided by JavaMail.
    • Constructor Detail

      • MultipartMimeUtils

        public MultipartMimeUtils()
    • Method Detail

      • parseMultipartRequest

        public static javax.mail.internet.MimeMultipart parseMultipartRequest​(javax.servlet.http.HttpServletRequest req)
                                                                       throws IOException,
                                                                              javax.mail.MessagingException
        Parse the request body and return a MimeMultipart representing the request.
        Throws:
        IOException
        javax.mail.MessagingException
      • createDataSource

        public static DataSource createDataSource​(String contentType,
                                                  byte[] data)
        Create a read-only DataSource with the specific content type and body.
      • getFieldName

        public static String getFieldName​(javax.mail.BodyPart part)
                                   throws javax.mail.MessagingException
        Extract the form name from the Content-Disposition in a multipart/form-data request.
        Throws:
        javax.mail.MessagingException
      • getTextContent

        public static String getTextContent​(javax.mail.BodyPart part)
                                     throws javax.mail.MessagingException,
                                            IOException
        Extract the text content for a BodyPart, assuming the default encoding.
        Throws:
        javax.mail.MessagingException
        IOException