本文整理了Java中javax.mail.internet.MimeMessage.updateHeaders()
方法的一些代码示例,展示了MimeMessage.updateHeaders()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MimeMessage.updateHeaders()
方法的具体详情如下:
包路径:javax.mail.internet.MimeMessage
类名称:MimeMessage
方法名:updateHeaders
[英]Called by the saveChanges
method to actually update the MIME headers. The implementation here sets the Content-Transfer-Encoding
header (if needed and not already set), the Date
header (if not already set), the MIME-Version
header and the Message-ID
header. Also, if the content of this message is a MimeMultipart
, its updateHeaders
method is called.
If the #cachedContent field is not null (that is, it references a Multipart or Message object), then that object is used to set a new DataHandler, any stream data used to create this object is discarded, and the #cachedContent field is cleared.
[中]由saveChanges
方法调用以实际更新MIME头。此处的实现设置Content-Transfer-Encoding
头(如果需要且尚未设置),Date
头(如果尚未设置),MIME-Version
头和Message-ID
头。此外,如果此消息的内容是MimeMultipart
,则会调用其updateHeaders
方法。
如果#cachedContent字段不为null(即,它引用多部分或消息对象),则该对象用于设置新的DataHandler,用于创建此对象的任何流数据都将被丢弃,#cachedContent字段将被清除。
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Updates the appropriate header fields of this message to be
* consistent with the message's contents. If this message is
* contained in a Folder, any changes made to this message are
* committed to the containing folder. <p>
*
* If any part of a message's headers or contents are changed,
* <code>saveChanges</code> must be called to ensure that those
* changes are permanent. Otherwise, any such modifications may or
* may not be saved, depending on the folder implementation. <p>
*
* Messages obtained from folders opened READ_ONLY should not be
* modified and saveChanges should not be called on such messages. <p>
*
* This method sets the <code>modified</code> flag to true, the
* <code>save</code> flag to true, and then calls the
* <code>updateHeaders</code> method.
*
* @exception IllegalWriteException if the underlying
* implementation does not support modification
* @exception IllegalStateException if this message is
* obtained from a READ_ONLY folder.
* @exception MessagingException for other failures
*/
public void saveChanges() throws MessagingException {
modified = true;
saved = true;
updateHeaders();
}
代码示例来源:origin: com.sun.mail/javax.mail
/**
* Updates the appropriate header fields of this message to be
* consistent with the message's contents. If this message is
* contained in a Folder, any changes made to this message are
* committed to the containing folder. <p>
*
* If any part of a message's headers or contents are changed,
* <code>saveChanges</code> must be called to ensure that those
* changes are permanent. Otherwise, any such modifications may or
* may not be saved, depending on the folder implementation. <p>
*
* Messages obtained from folders opened READ_ONLY should not be
* modified and saveChanges should not be called on such messages. <p>
*
* This method sets the <code>modified</code> flag to true, the
* <code>save</code> flag to true, and then calls the
* <code>updateHeaders</code> method.
*
* @exception IllegalWriteException if the underlying
* implementation does not support modification
* @exception IllegalStateException if this message is
* obtained from a READ_ONLY folder.
* @exception MessagingException for other failures
*/
@Override
public void saveChanges() throws MessagingException {
modified = true;
saved = true;
updateHeaders();
}
代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.3.1_spec
/**
* Saves any changes on this message. When called, the modified
* and saved flags are set to true and updateHeaders() is called
* to force updates.
*
* @exception MessagingException
*/
public void saveChanges() throws MessagingException {
// setting modified invalidates the current content.
modified = true;
saved = true;
// update message headers from the content.
updateHeaders();
}
代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.4_spec
/**
* Saves any changes on this message. When called, the modified
* and saved flags are set to true and updateHeaders() is called
* to force updates.
*
* @exception MessagingException
*/
public void saveChanges() throws MessagingException {
// setting modified invalidates the current content.
modified = true;
saved = true;
// update message headers from the content.
updateHeaders();
}
代码示例来源:origin: com.sun.mail/mailapi
/**
* Updates the appropriate header fields of this message to be
* consistent with the message's contents. If this message is
* contained in a Folder, any changes made to this message are
* committed to the containing folder. <p>
*
* If any part of a message's headers or contents are changed,
* <code>saveChanges</code> must be called to ensure that those
* changes are permanent. Otherwise, any such modifications may or
* may not be saved, depending on the folder implementation. <p>
*
* Messages obtained from folders opened READ_ONLY should not be
* modified and saveChanges should not be called on such messages. <p>
*
* This method sets the <code>modified</code> flag to true, the
* <code>save</code> flag to true, and then calls the
* <code>updateHeaders</code> method.
*
* @exception IllegalWriteException if the underlying
* implementation does not support modification
* @exception IllegalStateException if this message is
* obtained from a READ_ONLY folder.
* @exception MessagingException for other failures
*/
@Override
public void saveChanges() throws MessagingException {
modified = true;
saved = true;
updateHeaders();
}
代码示例来源:origin: javax.mail/javax.mail-api
/**
* Updates the appropriate header fields of this message to be
* consistent with the message's contents. If this message is
* contained in a Folder, any changes made to this message are
* committed to the containing folder. <p>
*
* If any part of a message's headers or contents are changed,
* <code>saveChanges</code> must be called to ensure that those
* changes are permanent. Otherwise, any such modifications may or
* may not be saved, depending on the folder implementation. <p>
*
* Messages obtained from folders opened READ_ONLY should not be
* modified and saveChanges should not be called on such messages. <p>
*
* This method sets the <code>modified</code> flag to true, the
* <code>save</code> flag to true, and then calls the
* <code>updateHeaders</code> method.
*
* @exception IllegalWriteException if the underlying
* implementation does not support modification
* @exception IllegalStateException if this message is
* obtained from a READ_ONLY folder.
* @exception MessagingException for other failures
*/
@Override
public void saveChanges() throws MessagingException {
modified = true;
saved = true;
updateHeaders();
}
代码示例来源:origin: com.sun.mail/jakarta.mail
/**
* Updates the appropriate header fields of this message to be
* consistent with the message's contents. If this message is
* contained in a Folder, any changes made to this message are
* committed to the containing folder. <p>
*
* If any part of a message's headers or contents are changed,
* <code>saveChanges</code> must be called to ensure that those
* changes are permanent. Otherwise, any such modifications may or
* may not be saved, depending on the folder implementation. <p>
*
* Messages obtained from folders opened READ_ONLY should not be
* modified and saveChanges should not be called on such messages. <p>
*
* This method sets the <code>modified</code> flag to true, the
* <code>save</code> flag to true, and then calls the
* <code>updateHeaders</code> method.
*
* @exception IllegalWriteException if the underlying
* implementation does not support modification
* @exception IllegalStateException if this message is
* obtained from a READ_ONLY folder.
* @exception MessagingException for other failures
*/
@Override
public void saveChanges() throws MessagingException {
modified = true;
saved = true;
updateHeaders();
}
代码示例来源:origin: com.sun.mail/android-mail
/**
* Updates the appropriate header fields of this message to be
* consistent with the message's contents. If this message is
* contained in a Folder, any changes made to this message are
* committed to the containing folder. <p>
*
* If any part of a message's headers or contents are changed,
* <code>saveChanges</code> must be called to ensure that those
* changes are permanent. Otherwise, any such modifications may or
* may not be saved, depending on the folder implementation. <p>
*
* Messages obtained from folders opened READ_ONLY should not be
* modified and saveChanges should not be called on such messages. <p>
*
* This method sets the <code>modified</code> flag to true, the
* <code>save</code> flag to true, and then calls the
* <code>updateHeaders</code> method.
*
* @exception IllegalWriteException if the underlying
* implementation does not support modification
* @exception IllegalStateException if this message is
* obtained from a READ_ONLY folder.
* @exception MessagingException for other failures
*/
@Override
public void saveChanges() throws MessagingException {
modified = true;
saved = true;
updateHeaders();
}
代码示例来源:origin: javax.mail/com.springsource.javax.mail
/**
* Updates the appropriate header fields of this message to be
* consistent with the message's contents. If this message is
* contained in a Folder, any changes made to this message are
* committed to the containing folder. <p>
*
* If any part of a message's headers or contents are changed,
* <code>saveChanges</code> must be called to ensure that those
* changes are permanent. Otherwise, any such modifications may or
* may not be saved, depending on the folder implementation. <p>
*
* Messages obtained from folders opened READ_ONLY should not be
* modified and saveChanges should not be called on such messages. <p>
*
* This method sets the <code>modified</code> flag to true, the
* <code>save</code> flag to true, and then calls the
* <code>updateHeaders</code> method.
*
* @exception IllegalWriteException if the underlying
* implementation does not support modification
* @exception IllegalStateException if this message is
* obtained from a READ_ONLY folder.
* @exception MessagingException
*/
public void saveChanges() throws MessagingException {
modified = true;
saved = true;
updateHeaders();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax.mail
/**
* Updates the appropriate header fields of this message to be
* consistent with the message's contents. If this message is
* contained in a Folder, any changes made to this message are
* committed to the containing folder. <p>
*
* If any part of a message's headers or contents are changed,
* <code>saveChanges</code> must be called to ensure that those
* changes are permanent. Otherwise, any such modifications may or
* may not be saved, depending on the folder implementation. <p>
*
* Messages obtained from folders opened READ_ONLY should not be
* modified and saveChanges should not be called on such messages. <p>
*
* This method sets the <code>modified</code> flag to true, the
* <code>save</code> flag to true, and then calls the
* <code>updateHeaders<code> method.
*
* @exception IllegalWriteException if the underlying
* implementation does not support modification
* @exception IllegalStateException if this message is
* obtained from a READ_ONLY folder.
* @exception MessagingException
*/
public void saveChanges() throws MessagingException {
modified = true;
saved = true;
updateHeaders();
}
代码示例来源:origin: org.glassfish.metro/webservices-extra
/**
* Updates the appropriate header fields of this message to be
* consistent with the message's contents. If this message is
* contained in a Folder, any changes made to this message are
* committed to the containing folder. <p>
*
* If any part of a message's headers or contents are changed,
* <code>saveChanges</code> must be called to ensure that those
* changes are permanent. Otherwise, any such modifications may or
* may not be saved, depending on the folder implementation. <p>
*
* Messages obtained from folders opened READ_ONLY should not be
* modified and saveChanges should not be called on such messages. <p>
*
* This method sets the <code>modified</code> flag to true, the
* <code>save</code> flag to true, and then calls the
* <code>updateHeaders</code> method.
*
* @exception IllegalWriteException if the underlying
* implementation does not support modification
* @exception IllegalStateException if this message is
* obtained from a READ_ONLY folder.
* @exception MessagingException for other failures
*/
@Override
public void saveChanges() throws MessagingException {
modified = true;
saved = true;
updateHeaders();
}
代码示例来源:origin: jboss/jboss-javaee-specs
/**
* Updates the appropriate header fields of this message to be
* consistent with the message's contents. If this message is
* contained in a Folder, any changes made to this message are
* committed to the containing folder. <p>
*
* If any part of a message's headers or contents are changed,
* <code>saveChanges</code> must be called to ensure that those
* changes are permanent. Otherwise, any such modifications may or
* may not be saved, depending on the folder implementation. <p>
*
* Messages obtained from folders opened READ_ONLY should not be
* modified and saveChanges should not be called on such messages. <p>
*
* This method sets the <code>modified</code> flag to true, the
* <code>save</code> flag to true, and then calls the
* <code>updateHeaders</code> method.
*
* @exception IllegalWriteException if the underlying
* implementation does not support modification
* @exception IllegalStateException if this message is
* obtained from a READ_ONLY folder.
* @exception MessagingException for other failures
*/
@Override
public void saveChanges() throws MessagingException {
modified = true;
saved = true;
updateHeaders();
}
代码示例来源:origin: org.apache.james/james-server-mailets
@Override
protected void updateHeaders() throws MessagingException {
if (getMessageID() == null) {
super.updateHeaders();
} else {
modified = false;
}
}
}
代码示例来源:origin: org.vx68k.quercus/quercus
@Override
protected void updateHeaders()
throws MessagingException
{
super.updateHeaders();
if (_messageId != null)
setHeader("Message-ID", _messageId);
}
代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl
protected void updateHeaders() throws MessagingException
{
super.updateHeaders();
if (m_id != null)
{
setHeader("Message-Id", m_id);
}
}
代码示例来源:origin: org.apache.james/apache-jsieve-mailet
protected void updateHeaders() throws MessagingException
{
if (getMessageID() == null)
super.updateHeaders();
else
modified = false;
}
};
代码示例来源:origin: org.esupportail/esup-commons-mail
@Override
protected synchronized void updateHeaders() throws MessagingException {
super.updateHeaders();
if ((messageId != null) && (messageId.length() > 0)) {
setHeader("Message-ID", messageId);
}
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax.mail
protected void updateHeaders() throws MessagingException {
super.updateHeaders();
setHeadersFromFlags();
}
代码示例来源:origin: org.mnode.mstor/mstor
/**
* Attempts to update headers in metadata after updating headers in superclass.
* @throws MessagingException where an error occurs in the delegate update
*/
private void updateHeaders(boolean includeDefaults) throws MessagingException {
if (includeDefaults) {
super.updateHeaders();
}
if (delegate != null) {
try {
delegate.setHeaders(headers);
}
catch (Exception e) {
throw new MessagingException("Error updating headers", e);
}
}
}
代码示例来源:origin: i2p/i2p.i2p-bote
/**
* Removes all headers that are not on the whitelist, and initializes some
* basic header fields.<br/>
* Called by {@link #saveChanges()}, see JavaMail JavaDoc.
* @throws MessagingException
*/
@Override
public void updateHeaders() throws MessagingException {
super.updateHeaders();
scrubHeaders();
removeRecipientNames();
// Depending on includeSendTime, set the send time or remove the send time field
if (includeSendTime) {
// Ensure the "Date" field is set in UTC time, using the English locale.
MailDateFormat formatter = new MailDateFormat();
formatter.setTimeZone(TimeZone.getTimeZone("GMT")); // always use UTC for outgoing mail
if (getSentDate() == null)
setHeader("Date", formatter.format(new Date()));
else
setHeader("Date", formatter.format(getSentDate()));
}
else
removeHeader("Date");
}
内容来源于网络,如有侵权,请联系作者删除!