Examples of MimePart


Examples of javax.mail.internet.MimePart

   * @throws MessagingException
   * @throws IOException
   */
  private static ByteArrayOutputStream getBodyAsStream(MimeMessage oMsg)
    throws MessagingException,IOException {
    MimePart oText = null;
    ByteArrayOutputStream byStrm;

    if (DebugFile.trace) {
      DebugFile.writeln("Begin DBFolder.getBodyAsStream([MimeMessage])");
      DebugFile.incIdent();
      if (null!=oMsg) DebugFile.writeln(oMsg.getClass().getName());
                 else DebugFile.writeln("MimeMessage is null");
    }

    if (oMsg.getClass().getName().equals("com.knowgate.hipermail.DBMimeMessage"))
      // If appended message is a DBMimeMessage then use DBMimeMessage.getBody()
      // for getting HTML text part or plain text part of the MULTIPART/ALTERNATIVE
      oText = ((DBMimeMessage) oMsg).getBody();
    else {
      // Else if the appended message is a MimeMessage use standard Java Mail getBody() method
      oText = new DBMimeMessage(oMsg).getBody();
    } // fi

    if (DebugFile.trace) {
      DebugFile.writeln("MimePart encoding is "+oText.getEncoding());
      DebugFile.writeln("MimePart size is "+String.valueOf(oText.getSize()));
    }

    // *************************************************************************
    // Initialize a byte array for containing the message body

    if (DebugFile.trace) DebugFile.writeln("ByteArrayOutputStream byOutStrm = new ByteArrayOutputStream("+String.valueOf(oText.getSize()>0 ? oText.getSize() : 8192)+")");

    byStrm = new ByteArrayOutputStream(oText.getSize()>0 ? oText.getSize() : 8192);
    oText.writeTo(byStrm);

    if (DebugFile.trace) {
      DebugFile.decIdent();
      DebugFile.writeln("End DBFolder.getBodyAsStream() : " + Gadgets.left(new String(byStrm.toByteArray()),100));
    }
View Full Code Here

Examples of javax.mail.internet.MimePart

    private static void flattenMessageHelper
            (MimePart part, ContentTypePreference ctPref, List l) {
        try {
            if (part.isMimeType("multipart/alternative")) {
                MimeMultipart mp = (MimeMultipart) part.getContent();
                MimePart bestPart = null;
                int ctMax = 0;
                for (int i = 0; i < mp.getCount(); i++) {
                    MimePart p = (MimePart) mp.getBodyPart(i);
                    int ctPrefN = ctPref.preference(part);
                    if (ctPrefN > ctMax) {
                        ctMax = ctPrefN;
                        bestPart = p;
                    }
View Full Code Here

Examples of javax.mail.internet.MimePart

         */
        if (part.getContent() instanceof String && (part.isMimeType("text/plain"))) {
            characters((String) part.getContent());
        } else if (part.isMimeType("multipart/alternative")) {
            MimeMultipart mp = (MimeMultipart) part.getContent();
            MimePart bestPart = null;
            int ctMax = 0;
            for (int i = 0; i < mp.getCount(); i++) {
                MimePart p = (MimePart) mp.getBodyPart(i);
                int ctPrefN = alternativeMailCtPref.preference(p);
                if (ctPrefN > ctMax) {
                    ctMax = ctPrefN;
                    bestPart = p;
                }
View Full Code Here

Examples of javax.mail.internet.MimePart

         */
        if (part.getContent() instanceof String && (part.isMimeType("text/plain"))) {
            characters((String) part.getContent());
        } else if (part.isMimeType("multipart/alternative")) {
            MimeMultipart mp = (MimeMultipart) part.getContent();
            MimePart bestPart = null;
            int ctMax = 0;
            for (int i = 0; i < mp.getCount(); i++) {
                MimePart p = (MimePart) mp.getBodyPart(i);
                int ctPrefN = alternativeMailCtPref.preference(p);
                if (ctPrefN > ctMax) {
                    ctMax = ctPrefN;
                    bestPart = p;
                }
View Full Code Here

Examples of javax.mail.internet.MimePart

    }

    public AWResponseGenerating resourceResponse ()
    {
        String contentId = _resourceUrl.substring(4);
        MimePart part = _parsedMessage.partForId(contentId);
        return downloadPart(part, false);
    }
View Full Code Here

Examples of javax.wsdl.extensions.mime.MIMEPart

    public void process(JavaMethod jm, MIMEMultipartRelated ext, JavaType.Style style) throws ToolException {
        List mimeParts = ext.getMIMEParts();
        Iterator itParts = mimeParts.iterator();
        while (itParts.hasNext()) {
            MIMEPart mPart = (MIMEPart)itParts.next();
            Iterator extns = mPart.getExtensibilityElements().iterator();
            while (extns.hasNext()) {
                ExtensibilityElement extElement = (ExtensibilityElement)extns.next();
                if (extElement instanceof MIMEContent) {
                    MIMEContent mimeContent = (MIMEContent)extElement;
                    String mimeJavaType = getJavaTypeForMimeType(mPart);
View Full Code Here

Examples of javax.wsdl.extensions.mime.MIMEPart

        if (parts != null) {
            List<MessagePartInfo> bodyParts = new ArrayList<MessagePartInfo>();
            for (Iterator<?> itr = parts.iterator(); itr.hasNext();) {
                Object part = itr.next();
                if (part instanceof MIMEPart) {
                    MIMEPart mpart = (MIMEPart) part;
                    attParts = handleMimePart(mpart, attParts, msg, bmsg, bodyParts, messageParts);
                } else {
                    addSoapBodyPart(msg, bodyParts, (String)part);
                }
            }
View Full Code Here

Examples of javax.wsdl.extensions.mime.MIMEPart

    public void processMultipart(JavaMethod jm, BindingOperationInfo operation,
                                 MIMEMultipartRelated ext, JavaType.Style style) throws ToolException {
        List mimeParts = ext.getMIMEParts();
        Iterator itParts = mimeParts.iterator();
        while (itParts.hasNext()) {
            MIMEPart mPart = (MIMEPart)itParts.next();
            Iterator extns = mPart.getExtensibilityElements().iterator();
            while (extns.hasNext()) {
                ExtensibilityElement extElement = (ExtensibilityElement)extns.next();
                if (extElement instanceof MIMEContent) {
                    MIMEContent mimeContent = (MIMEContent)extElement;
                    String mimeJavaType = getJavaTypeForMimeType(mPart);
View Full Code Here

Examples of javax.wsdl.extensions.mime.MIMEPart

                SOAP12Body soapBody = (SOAP12Body) extElement;
                partsList = soapBody.getParts();
            } else if (extElement instanceof MIMEMultipartRelated) {
                MIMEMultipartRelated minMimeMultipartRelated = (MIMEMultipartRelated) extElement;
                List mimePartsList = minMimeMultipartRelated.getMIMEParts();
                MIMEPart mimePart = null;
                Object object;
                List mimePartElements;
                ExtensibilityElement mimePartExtensibilityElement;
                for (Iterator mimePartsIter = mimePartsList.iterator(); mimePartsIter.hasNext();) {
                    object = mimePartsIter.next();
                    if (object instanceof MIMEPart) {
                        mimePart = (MIMEPart) object;
                        mimePartElements = mimePart.getExtensibilityElements();
                        for (Iterator mimePartElementsIter = mimePartElements.iterator(); mimePartElementsIter.hasNext();)
                        {
                            mimePartExtensibilityElement = (ExtensibilityElement) mimePartElementsIter.next();
                            if (mimePartExtensibilityElement instanceof SOAPBody) {
                                SOAPBody soapBody = (SOAPBody) mimePartExtensibilityElement;
View Full Code Here

Examples of javax.wsdl.extensions.mime.MIMEPart

        if (parts != null) {
            List<MessagePartInfo> bodyParts = new ArrayList<MessagePartInfo>();
            for (Iterator itr = parts.iterator(); itr.hasNext();) {
                Object part = itr.next();
                if (part instanceof MIMEPart) {
                    MIMEPart mpart = (MIMEPart) part;
                    attParts = handleMimePart(mpart, attParts, msg, bmsg, bodyParts, messageParts);
                } else {
                    addSoapBodyPart(msg, bodyParts, (String)part);
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.