亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
国产精品精品国产色婷婷| 欧美亚洲日本国产| 视频精品一区二区| 亚洲精品第一国产综合野| 亚洲人吸女人奶水| 亚洲精品伦理在线| 亚洲精品欧美在线| 亚洲在线免费播放| 天天综合网 天天综合色| 亚洲综合一区二区精品导航| 一区二区三区 在线观看视频| 亚洲品质自拍视频| 亚洲一区二区三区四区五区黄| 最好看的中文字幕久久| 亚洲视频每日更新| 亚洲成人免费av| 日本不卡1234视频| 国产呦萝稀缺另类资源| 成人av手机在线观看| 波多野结衣的一区二区三区| 91九色02白丝porn| 日韩一级高清毛片| 久久久精品国产免费观看同学| 国产日产亚洲精品系列| 亚洲欧美激情一区二区| 视频精品一区二区| 国产.欧美.日韩| 欧美午夜电影网| 久久亚洲捆绑美女| 一区二区三区在线视频免费| 日本不卡一二三| zzijzzij亚洲日本少妇熟睡| 在线观看亚洲专区| 久久久久久久综合日本| 一区二区三区在线影院| 国产在线不卡视频| 欧美亚洲尤物久久| 国产亚洲欧美日韩日本| 一区二区三区在线高清| 久草精品在线观看| 欧美视频你懂的| 国产日产欧美一区二区三区| 丝袜美腿高跟呻吟高潮一区| 成人不卡免费av| 精品奇米国产一区二区三区| 亚洲男人天堂av网| 国产毛片精品国产一区二区三区| 99精品偷自拍| 久久人人爽人人爽| 亚洲成人综合网站| gogo大胆日本视频一区| 欧美一区2区视频在线观看| 成人免费小视频| 国产麻豆精品theporn| 51精品国自产在线| 一区二区三区高清| 成人丝袜高跟foot| 欧美mv日韩mv国产| 偷窥少妇高潮呻吟av久久免费| 97精品国产97久久久久久久久久久久| 欧美日韩国产精选| 国产精品动漫网站| 成人免费视频网站在线观看| 精品国产乱码久久久久久1区2区| 亚洲电影中文字幕在线观看| 91在线国产观看| 国产精品乱码一区二区三区软件| 久久精工是国产品牌吗| 欧美一二三在线| 日韩国产欧美一区二区三区| 欧美三级视频在线观看| 亚洲一区二区综合| 欧洲一区在线电影| 亚洲综合小说图片| 在线国产电影不卡| 亚洲国产一区二区三区青草影视| 色婷婷激情久久| 亚洲精品一卡二卡| 欧美熟乱第一页| 日日噜噜夜夜狠狠视频欧美人| 欧美日韩在线亚洲一区蜜芽| 亚洲福利一区二区三区| 欧美日韩国产片| 蜜臀久久久99精品久久久久久| 日韩一区二区精品| 久久国产人妖系列| 国产视频一区在线观看| 高清不卡一二三区| 亚洲视频1区2区| 欧美三级视频在线播放| 日韩专区中文字幕一区二区| 日韩欧美三级在线| 高清av一区二区| 亚洲欧洲制服丝袜| 在线综合+亚洲+欧美中文字幕| 奇米影视在线99精品| 精品久久久久久久人人人人传媒 | 国内精品视频一区二区三区八戒| 日韩欧美亚洲国产另类| 国产精品正在播放| 亚洲女爱视频在线| 日韩午夜在线影院| 懂色av中文一区二区三区| 亚洲另类中文字| 日韩欧美一级精品久久| 国产成人自拍在线| 亚洲一区二区五区| 精品成人免费观看| 91麻豆福利精品推荐| 捆绑变态av一区二区三区| 国产精品入口麻豆原神| 欧美日韩国产在线播放网站| 韩国成人精品a∨在线观看| 成人欧美一区二区三区黑人麻豆| 欧美精品久久一区| 成人免费视频免费观看| 日韩精品一级中文字幕精品视频免费观看 | 精品免费国产二区三区| 国产一区二区三区美女| 亚洲欧美一区二区不卡| 欧美日韩中文国产| 麻豆精品一区二区| 亚洲视频免费在线观看| www一区二区| 欧美日韩一区二区三区四区| 国产传媒欧美日韩成人| 无码av免费一区二区三区试看| 精品少妇一区二区三区在线播放 | 国产丝袜美腿一区二区三区| 国产一区 二区| 一区二区三区日韩| 2023国产精华国产精品| 在线国产亚洲欧美| 风间由美中文字幕在线看视频国产欧美| 亚洲一区欧美一区| 国产欧美一区二区精品性色超碰 | 成人av免费在线播放| 日产国产欧美视频一区精品| 亚洲你懂的在线视频| 亚洲国产精品高清| 精品人伦一区二区色婷婷| 欧美日韩一卡二卡三卡| 99久久久久久| 国产精品一线二线三线| 蜜桃久久av一区| 三级成人在线视频| 亚洲成人精品在线观看| 亚洲人一二三区| 亚洲欧美一区二区不卡| 136国产福利精品导航| 欧美国产97人人爽人人喊| 久久久国产精品午夜一区ai换脸| 制服丝袜国产精品| 欧美精品在线一区二区| 欧美性大战久久| 欧美日韩一区二区三区免费看| 91原创在线视频| 99在线精品免费| 色八戒一区二区三区| 色域天天综合网| 色婷婷亚洲婷婷| 欧美日产在线观看| 91精品国产黑色紧身裤美女| 91精品国产综合久久香蕉麻豆| 欧美日韩www| 日韩欧美国产三级电影视频| 日韩一区二区免费高清| 精品久久久久久久久久久久包黑料 | 欧美亚洲国产一区二区三区| 欧美在线免费播放| 欧美图区在线视频| 制服丝袜中文字幕亚洲| 欧美大片在线观看一区二区| 欧美精品一区二区精品网| 国产欧美日韩精品a在线观看| 欧美国产精品中文字幕| 国产精品乱码人人做人人爱| 亚洲色图在线看| 午夜精品福利在线| 国产一区在线精品| 91麻豆123| 欧美一区二区美女| 日本一区二区三区国色天香| 亚洲色图欧美偷拍| 蜜臀av一区二区| 99久久亚洲一区二区三区青草 | 欧美日韩大陆在线| xf在线a精品一区二区视频网站| 亚洲视频一区二区在线| 肉色丝袜一区二区| 成人午夜精品在线| 欧美吻胸吃奶大尺度电影| 日韩欧美国产电影| 中文字幕综合网| 久久电影国产免费久久电影| 99久久久国产精品免费蜜臀| 欧美一区二区三区的| 中文字幕一区在线观看视频| 视频一区二区中文字幕| 成人激情小说网站|