Class MimeUtils


  • public class MimeUtils
    extends java.lang.Object
    This class is defines utilities for mime.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String[] filter
      Field filter
      protected static org.apache.commons.logging.Log log
      Field log
    • Constructor Summary

      Constructors 
      Constructor Description
      MimeUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static javax.mail.internet.MimeMultipart createMP​(java.lang.String env, java.util.Collection parts, int sendType)
      This routine will create a multipart object from the parts and the SOAP content.
      protected static long getContentLength​(javax.mail.internet.MimeBodyPart bp)
      Determine the length for the individual part.
      static long getContentLength​(javax.mail.Multipart mp)
      Determine as efficiently as possible the content length for attachments in a mail Multipart.
      static java.lang.String getContentType​(javax.mail.internet.MimeMultipart mp)
      This routine will get the content type from a mulit-part mime message.
      static void writeToMultiPartStream​(java.io.OutputStream os, javax.mail.internet.MimeMultipart mp)
      This routine will the multi part type and write it out to a stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • log

        protected static org.apache.commons.logging.Log log
        Field log
      • filter

        public static java.lang.String[] filter
        Field filter
    • Constructor Detail

      • MimeUtils

        public MimeUtils()
    • Method Detail

      • getContentLength

        public static long getContentLength​(javax.mail.Multipart mp)
                                     throws javax.mail.MessagingException,
                                            java.io.IOException
        Determine as efficiently as possible the content length for attachments in a mail Multipart.
        Parameters:
        mp - is the multipart to be serarched.
        Returns:
        the actual length.
        Throws:
        javax.mail.MessagingException
        java.io.IOException
      • getContentLength

        protected static long getContentLength​(javax.mail.internet.MimeBodyPart bp)
        Determine the length for the individual part.
        Parameters:
        bp - is the part to be searched.
        Returns:
        the length in bytes.
      • writeToMultiPartStream

        public static void writeToMultiPartStream​(java.io.OutputStream os,
                                                  javax.mail.internet.MimeMultipart mp)
        This routine will the multi part type and write it out to a stream.

        Note that is does *NOT* pass AxisProperties to javax.mail.Session.getInstance, but instead the System properties.

        Parameters:
        os - is the output stream to write to.
        mp - the multipart that needs to be written to the stream.
      • getContentType

        public static java.lang.String getContentType​(javax.mail.internet.MimeMultipart mp)
        This routine will get the content type from a mulit-part mime message.
        Parameters:
        mp - the MimeMultipart
        Returns:
        the content type
      • createMP

        public static javax.mail.internet.MimeMultipart createMP​(java.lang.String env,
                                                                 java.util.Collection parts,
                                                                 int sendType)
                                                          throws AxisFault
        This routine will create a multipart object from the parts and the SOAP content.
        Parameters:
        env - should be the text for the main root part.
        parts - contain a collection of the message parts.
        Returns:
        a new MimeMultipart object
        Throws:
        AxisFault