亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? multipartreport.java

?? 此源碼是在sun站點上提供的javamail基礎上改進。用來解決中文郵件或很多國際間郵件亂碼問題。版權屬于sun公司。不過當你開發webmail程序時做郵件展示時
?? JAVA
字號:
/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
 *
 * The contents of this file are subject to the terms of either the GNU
 * General Public License Version 2 only ("GPL") or the Common Development
 * and Distribution License("CDDL") (collectively, the "License").  You
 * may not use this file except in compliance with the License. You can obtain
 * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
 * or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
 * language governing permissions and limitations under the License.
 *
 * When distributing the software, include this License Header Notice in each
 * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
 * Sun designates this particular file as subject to the "Classpath" exception
 * as provided by Sun in the GPL Version 2 section of the License file that
 * accompanied this code.  If applicable, add the following below the License
 * Header, with the fields enclosed by brackets [] replaced by your own
 * identifying information: "Portions Copyrighted [year]
 * [name of copyright owner]"
 *
 * Contributor(s):
 *
 * If you wish your version of this file to be governed by only the CDDL or
 * only the GPL Version 2, indicate your decision by adding "[Contributor]
 * elects to include this software in this distribution under the [CDDL or GPL
 * Version 2] license."  If you don't indicate a single choice of license, a
 * recipient has the option to distribute your version of this file under
 * either the CDDL, the GPL Version 2 or to extend the choice of license to
 * its licensees as provided above.  However, if you add GPL Version 2 code
 * and therefore, elected the GPL Version 2 license, then the option applies
 * only if the new code is made subject to such option by the copyright
 * holder.
 */

/*
 * @(#)MultipartReport.java	1.7 07/05/04
 */

package com.sun.mail.dsn;

import java.io.*;
import java.util.Vector;

import javax.activation.*;
import javax.mail.*;
import javax.mail.internet.*;

/**
 * A multipart/report message content, as defined in
 * <A HREF="http://www.ietf.org/rfc/rfc3462.txt">RFC 3462</A>.
 * A multipart/report content is a container for mail reports
 * of any kind, and is most often used to return a delivery
 * status report.  This class only supports that most common
 * usage. <p>
 *
 * A MultipartReport object is a special type of MimeMultipart
 * object with a restricted set of body parts.  A MultipartReport
 * object contains:
 * <ul>
 * <li>[Required] A human readable text message describing the
 * reason the report was generated.</li>
 * <li>[Required] A {@link DeliveryStatus} object containing the
 * details for why the report was generated.</li>
 * <li>[Optional] A returned copy of the entire message, or just
 * its headers, which caused the generation of this report.
 * </ul>
 * Many of the normal MimeMultipart operations are restricted to
 * ensure that the MultipartReport object always follows this
 * structure.
 */
public class MultipartReport extends MimeMultipart {
    protected boolean constructed; // true when done with constructor

    /**
     * Construct a multipart/report object with no content.
     */
    public MultipartReport() throws MessagingException {
	super("report");
	// always at least two body parts
	MimeBodyPart mbp = new MimeBodyPart();
	setBodyPart(mbp, 0);
	mbp = new MimeBodyPart();
	setBodyPart(mbp, 1);
	constructed = true;
    }

    /**
     * Construct a multipart/report object with the specified plain
     * text and delivery status to be returned to the user.
     */
    public MultipartReport(String text, DeliveryStatus status)
				throws MessagingException {
	super("report");
	ContentType ct = new ContentType(contentType);
	ct.setParameter("report-type", "delivery-status");
	contentType = ct.toString();
	MimeBodyPart mbp = new MimeBodyPart();
	mbp.setText(text);
	setBodyPart(mbp, 0);
	mbp = new MimeBodyPart();
	mbp.setContent(status, "message/delivery-status");
	setBodyPart(mbp, 1);
	constructed = true;
    }

    /**
     * Construct a multipart/report object with the specified plain
     * text, delivery status, and original message to be returned to the user.
     */
    public MultipartReport(String text, DeliveryStatus status,
				MimeMessage msg) throws MessagingException {
	this(text, status);
	if (msg != null) {
	    MimeBodyPart mbp = new MimeBodyPart();
	    mbp.setContent(msg, "message/rfc822");
	    setBodyPart(mbp, 2);
	}
    }

    /**
     * Construct a multipart/report object with the specified plain
     * text, delivery status, and headers from the original message
     * to be returned to the user.
     */
    public MultipartReport(String text, DeliveryStatus status,
				InternetHeaders hdr) throws MessagingException {
	this(text, status);
	if (hdr != null) {
	    MimeBodyPart mbp = new MimeBodyPart();
	    mbp.setContent(new MessageHeaders(hdr), "text/rfc822-headers");
	    setBodyPart(mbp, 2);
	}
    }

    /**
     * Constructs a MultipartReport object and its bodyparts from the 
     * given DataSource. <p>
     *
     * @param	ds	DataSource, can be a MultipartDataSource
     */
    public MultipartReport(DataSource ds) throws MessagingException {
	super(ds);
	parse();
	constructed = true;
	/*
	 * Can't fail to construct object because some programs just
	 * want to treat this as a Multipart and examine the parts.
	 *
	if (getCount() < 2 || getCount() > 3)	// XXX allow extra parts
	    throw new MessagingException(
		"Wrong number of parts in multipart/report: " + getCount());
	 */
    }

    /**
     * Get the plain text to be presented to the user, if there is any.
     * Rarely, the message may contain only HTML text, or no text at
     * all.  If the text body part of this multipart/report object is
     * of type text/plain, or if it is of type multipart/alternative
     * and contains a text/plain part, the text from that part is
     * returned.  Otherwise, null is return and the {@link #getTextBodyPart
     * getTextBodyPart} method may be used to extract the data.
     */
    public synchronized String getText() throws MessagingException {
	try {
	    BodyPart bp = getBodyPart(0);
	    if (bp.isMimeType("text/plain"))
		return (String)bp.getContent();
	    if (bp.isMimeType("multipart/alternative")) {
		Multipart mp = (Multipart)bp.getContent();
		for (int i = 0; i < mp.getCount(); i++) {
		    bp = mp.getBodyPart(i);
		    if (bp.isMimeType("text/plain"))
			return (String)bp.getContent();
		}
	    }
	} catch (IOException ex) {
	    throw new MessagingException("Exception getting text content", ex);
	}
	return null;
    }

    /**
     * Set the message to be presented to the user as just a text/plain
     * part containing the specified text.
     */
    public synchronized void setText(String text) throws MessagingException {
	MimeBodyPart mbp = new MimeBodyPart();
	mbp.setText(text);
	setBodyPart(mbp, 0);
    }

    /**
     * Return the body part containing the message to be presented to
     * the user, usually just a text/plain part.
     */
    public synchronized MimeBodyPart getTextBodyPart()
				throws MessagingException {
	return (MimeBodyPart)getBodyPart(0);
    }

    /**
     * Set the body part containing the text to be presented to the
     * user.  Usually this a text/plain part, but it might also be
     * a text/html part or a multipart/alternative part containing
     * text/plain and text/html parts.  Any type is allowed here
     * but these types are most common.
     */
    public synchronized void setTextBodyPart(MimeBodyPart mbp)
				throws MessagingException {
	setBodyPart(mbp, 0);
    }

    /**
     * Get the delivery status associated with this multipart/report.
     */
    public synchronized DeliveryStatus getDeliveryStatus()
				throws MessagingException {
	if (getCount() < 2)
	    return null;
	BodyPart bp = getBodyPart(1);
	if (!bp.isMimeType("message/delivery-status"))
	    return null;
	try {
	    return (DeliveryStatus)bp.getContent();
	} catch (IOException ex) {
	    throw new MessagingException("IOException getting DeliveryStatus",
					ex);
	}
    }

    /**
     * Set the delivery status associated with this multipart/report.
     */
    public synchronized void setDeliveryStatus(DeliveryStatus status)
				throws MessagingException {
	MimeBodyPart mbp = new MimeBodyPart();
	mbp.setContent(status, "message/delivery-status");
	setBodyPart(mbp, 2);
	ContentType ct = new ContentType(contentType);
	ct.setParameter("report-type", "delivery-status");
	contentType = ct.toString();
    }

    /**
     * Get the original message that is being returned along with this
     * multipart/report.  If no original message is included, null is
     * returned.  In some cases only the headers of the original
     * message will be returned as an object of type MessageHeaders.
     */
    public synchronized MimeMessage getReturnedMessage()
				throws MessagingException {
	if (getCount() < 3)
	    return null;
	BodyPart bp = getBodyPart(2);
	if (!bp.isMimeType("message/rfc822") &&
		!bp.isMimeType("text/rfc822-headers"))
	    return null;
	try {
	    return (MimeMessage)bp.getContent();
	} catch (IOException ex) {
	    throw new MessagingException("IOException getting ReturnedMessage",
					ex);
	}
    }

    /**
     * Set the original message to be returned as part of the
     * multipart/report.  If msg is null, any previously set
     * returned message or headers is removed.
     */
    public synchronized void setReturnedMessage(MimeMessage msg)
				throws MessagingException {
	if (msg == null) {
	    BodyPart part = (BodyPart)parts.elementAt(2);
	    super.removeBodyPart(2);
	    return;
	}
	MimeBodyPart mbp = new MimeBodyPart();
	if (msg instanceof MessageHeaders)
	    mbp.setContent(msg, "text/rfc822-headers");
	else
	    mbp.setContent(msg, "message/rfc822");
	setBodyPart(mbp, 2);
    }

    private synchronized void setBodyPart(BodyPart part, int index) 
				throws MessagingException {
	if (parts == null)	// XXX - can never happen?
	    parts = new Vector();

	if (index < parts.size())
	    super.removeBodyPart(index);
	super.addBodyPart(part, index);
    }


    // Override Multipart methods to preserve integrity of multipart/report.

    /**
     * Set the subtype.  Throws MessagingException.
     *
     * @param	subtype		Subtype
     * @exception	MessagingException	always; can't change subtype
     */
    public synchronized void setSubType(String subtype) 
			throws MessagingException {
	throw new MessagingException("Can't change subtype of MultipartReport");
    }

    /**
     * Remove the specified part from the multipart message.
     * Not allowed on a multipart/report object.
     *
     * @param   part	The part to remove
     * @exception	MessagingException always
     */
    public boolean removeBodyPart(BodyPart part) throws MessagingException {
	throw new MessagingException(
	    "Can't remove body parts from multipart/report");
    }

    /**
     * Remove the part at specified location (starting from 0).
     * Not allowed on a multipart/report object.
     *
     * @param   index	Index of the part to remove
     * @exception	MessagingException	always
     */
    public void removeBodyPart(int index) throws MessagingException {
	throw new MessagingException(
	    "Can't remove body parts from multipart/report");
    }

    /**
     * Adds a Part to the multipart.
     * Not allowed on a multipart/report object.
     *
     * @param  part  The Part to be appended
     * @exception       MessagingException	always
     */
    public synchronized void addBodyPart(BodyPart part) 
		throws MessagingException {
	// Once constructor is done, don't allow this anymore.
	if (!constructed)
	    super.addBodyPart(part);
	else
	    throw new MessagingException(
		"Can't add body parts to multipart/report 1");
    }

    /**
     * Adds a BodyPart at position <code>index</code>.
     * Not allowed on a multipart/report object.
     *
     * @param  part  The BodyPart to be inserted
     * @param  index Location where to insert the part
     * @exception       MessagingException	always
     */
    public synchronized void addBodyPart(BodyPart part, int index) 
				throws MessagingException {
	throw new MessagingException(
	    "Can't add body parts to multipart/report 2");
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人黄色电影在线 | 欧美三级视频在线观看| 国产成人精品影视| 国产69精品久久99不卡| 国产69精品久久99不卡| 不卡的av电影| 在线观看www91| 欧美肥妇毛茸茸| 欧美一级淫片007| 精品国产乱码久久久久久图片 | 亚洲一区在线观看免费观看电影高清| 国产精品国产三级国产专播品爱网| 久久久久久电影| 欧美经典一区二区| 亚洲免费在线视频一区 二区| 亚洲欧美成人一区二区三区| 亚洲最新视频在线播放| 午夜精品久久久久久久99水蜜桃| 午夜av电影一区| 国产一区二区伦理| www.视频一区| 欧美男同性恋视频网站| 精品国产乱码久久久久久闺蜜 | 欧美在线一区二区| 欧美一区二视频| 国产午夜亚洲精品不卡| 中文字幕日韩av资源站| 性做久久久久久免费观看| 麻豆精品一区二区三区| 成人短视频下载| 91精品国产麻豆| 国产精品美女一区二区三区| 午夜国产不卡在线观看视频| 国产成人高清视频| 欧美三级三级三级| 欧美韩日一区二区三区| 午夜视频一区二区三区| 国产99一区视频免费| 欧美精品乱码久久久久久| 欧美精彩视频一区二区三区| 日韩在线一区二区三区| 暴力调教一区二区三区| 91精品国产综合久久久久久漫画| 中日韩免费视频中文字幕| 美日韩一区二区| 91精品办公室少妇高潮对白| 久久久影院官网| 婷婷综合久久一区二区三区| gogo大胆日本视频一区| 精品国产乱码久久久久久图片| 亚洲欧美电影院| 成人一区在线观看| 久久久久久97三级| 日本午夜一区二区| 欧美视频自拍偷拍| 国产精品第一页第二页第三页| 美女视频免费一区| 777精品伊人久久久久大香线蕉| 国产精品日产欧美久久久久| 久久99精品国产麻豆婷婷 | 久久麻豆一区二区| 日韩av电影免费观看高清完整版在线观看| www.欧美亚洲| 国产精品国产三级国产| 国产精品一级在线| 久久你懂得1024| 激情文学综合丁香| 欧美精品一区二区三区蜜桃视频| 日韩国产成人精品| 91麻豆精品国产91久久久使用方法| 国产精品第五页| 91丝袜高跟美女视频| 国产精品天干天干在线综合| 国产激情视频一区二区在线观看| 日韩美女在线视频| 精品一区二区三区香蕉蜜桃| 日韩欧美在线影院| 精品夜夜嗨av一区二区三区| 精品粉嫩超白一线天av| 国产一区二区女| 国产精品网站在线| 91国偷自产一区二区开放时间 | 国产精品日韩精品欧美在线| 成人黄色国产精品网站大全在线免费观看| 日本一区二区成人| 成人激情视频网站| 一区二区三区四区不卡在线| 在线精品观看国产| 免费成人性网站| 久久精品一区蜜桃臀影院| 成人激情文学综合网| 一区二区高清在线| 91精选在线观看| 国产一区二区三区不卡在线观看| 国产欧美日本一区视频| 色伊人久久综合中文字幕| 三级一区在线视频先锋| 精品久久久久一区| 岛国精品在线观看| 亚洲国产一区二区三区青草影视| 欧美一级精品大片| 国产69精品久久777的优势| 亚洲伦在线观看| 日韩亚洲欧美中文三级| 国产精品资源站在线| 一区二区三区四区在线| 欧美一区二区啪啪| 成人高清av在线| 日韩精品电影一区亚洲| 国产欧美精品日韩区二区麻豆天美| 色综合天天综合色综合av| 麻豆精品一区二区三区| 亚洲女同ⅹxx女同tv| 欧美成人一区二区三区在线观看| 成人av动漫在线| 蜜臀av性久久久久蜜臀aⅴ流畅| 国产精品美女一区二区| 日韩欧美在线网站| 欧洲亚洲精品在线| 国产久卡久卡久卡久卡视频精品| 亚洲乱码国产乱码精品精98午夜| 精品国产污网站| 欧美日韩国产区一| 一本到一区二区三区| 国产高清不卡一区二区| 日韩**一区毛片| 亚洲欧美视频在线观看视频| 久久久精品黄色| 日韩视频免费观看高清完整版| 在线免费观看成人短视频| 岛国一区二区在线观看| 国产在线一区观看| 久久成人av少妇免费| 亚洲成人av资源| 亚洲精选一二三| 亚洲欧洲综合另类在线 | 不卡电影一区二区三区| 韩国毛片一区二区三区| 日韩中文字幕一区二区三区| 一区二区三区电影在线播| 亚洲三级免费电影| 中文字幕在线观看一区| 国产精品久久久久久久蜜臀 | 日韩无一区二区| 7777精品伊人久久久大香线蕉最新版| 91官网在线观看| 色拍拍在线精品视频8848| 91美女片黄在线| 97超碰欧美中文字幕| 91在线国产福利| 色综合天天综合网天天狠天天| 99re成人在线| 99精品视频在线观看| 91网站黄www| 欧美无砖专区一中文字| 欧美三级韩国三级日本三斤| 欧美日韩国产高清一区二区三区 | 久久精品视频一区二区三区| 日韩免费高清av| 精品国产123| 中文字幕不卡的av| 亚洲色欲色欲www| 亚洲激情网站免费观看| 亚洲福利电影网| 免费精品视频最新在线| 国产精品996| 91色porny在线视频| 欧美日韩国产一级| 欧美精品一区二区三区蜜桃视频| 精品久久久久久久久久久久包黑料 | 久久综合久久鬼色中文字| 久久精品夜色噜噜亚洲aⅴ| 欧美激情综合五月色丁香小说| 中文字幕一区二区三区乱码在线| 伊人一区二区三区| 青青草成人在线观看| 丰满少妇久久久久久久| 色老汉av一区二区三区| 欧美一区午夜精品| 中文字幕国产精品一区二区| 一区二区三区欧美日韩| 久久激五月天综合精品| av一区二区三区四区| 欧美老肥妇做.爰bbww视频| 久久婷婷综合激情| 亚洲美女视频在线| 韩国欧美国产1区| 91久久精品一区二区三| 久久尤物电影视频在线观看| 亚洲欧洲综合另类| 国产剧情av麻豆香蕉精品| 色婷婷香蕉在线一区二区| 2021国产精品久久精品| 日韩精品国产精品| 99麻豆久久久国产精品免费| 欧美一级片免费看| 亚洲精品日产精品乱码不卡| 国产呦精品一区二区三区网站| 一本在线高清不卡dvd| 久久精品水蜜桃av综合天堂|