javax.mail.internet.MimeBodyPart.updateHeaders()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(180)

本文整理了Java中javax.mail.internet.MimeBodyPart.updateHeaders()方法的一些代码示例,展示了MimeBodyPart.updateHeaders()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MimeBodyPart.updateHeaders()方法的具体详情如下:
包路径:javax.mail.internet.MimeBodyPart
类名称:MimeBodyPart
方法名:updateHeaders

MimeBodyPart.updateHeaders介绍

[英]Examine the content of this body part and update the appropriate MIME headers. Typical headers that get set here are Content-Type and Content-Transfer-Encoding. Headers might need to be updated in two cases:

  • A message being crafted by a mail application will certainly need to activate this method at some point to fill up its internal headers.
  • A message read in from a Store will have obtained all its headers from the store, and so doesn't need this. However, if this message is editable and if any edits have been made to either the content or message structure, we might need to resync our headers.
    In both cases this method is typically called by the Message.saveChanges method.

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.
[中]检查此正文部分的内容并更新相应的MIME标题。这里设置的典型标题是Content-TypeContent-Transfer-Encoding。在两种情况下,可能需要更新标题:
-邮件应用程序编写的邮件肯定需要在某个时候激活此方法以填充其内部标题。
-从存储中读入的消息将从存储中获取其所有头,因此不需要这样做。但是,如果此消息是可编辑的,并且如果对内容或消息结构进行了任何编辑,我们可能需要重新同步标题。
在这两种情况下,此方法通常由Message.saveChanges方法调用。
如果#cachedContent字段不为null(即,它引用多部分或消息对象),则该对象用于设置新的DataHandler,用于创建此对象的任何流数据都将被丢弃,#cachedContent字段将被清除。

代码示例

代码示例来源:origin: camunda/camunda-bpm-platform

/**
   * Force the <code>Content-Transfer-Encoding</code> header to use
   * the encoding that was specified when this object was created.
   */
  protected void updateHeaders() throws MessagingException {
  super.updateHeaders();
  MimeBodyPart.setEncoding(this, encoding);
  }
}

代码示例来源:origin: com.sun.mail/javax.mail

/**
   * Force the <code>Content-Transfer-Encoding</code> header to use
   * the encoding that was specified when this object was created.
   */
  @Override
  protected void updateHeaders() throws MessagingException {
  super.updateHeaders();
  MimeBodyPart.setEncoding(this, encoding);
  }
}

代码示例来源:origin: com.sun.mail/javax.mail

/**
 * Update headers. The default implementation here just
 * calls the <code>updateHeaders</code> method on each of its
 * children BodyParts. <p>
 *
 * Note that the boundary parameter is already set up when
 * a new and empty MimeMultipart object is created. <p>
 *
 * This method is called when the <code>saveChanges</code>
 * method is invoked on the Message object containing this
 * Multipart. This is typically done as part of the Message
 * send process, however note that a client is free to call
 * it any number of times. So if the header updating process is 
 * expensive for a specific MimeMultipart subclass, then it
 * might itself want to track whether its internal state actually
 * did change, and do the header updating only if necessary.
 *
 * @exception    MessagingException for failures
 */
protected synchronized void updateHeaders() throws MessagingException {
parse();
for (int i = 0; i < parts.size(); i++)
  ((MimeBodyPart)parts.elementAt(i)).updateHeaders();
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Update headers. The default implementation here just
 * calls the <code>updateHeaders</code> method on each of its
 * children BodyParts. <p>
 *
 * Note that the boundary parameter is already set up when
 * a new and empty MimeMultipart object is created. <p>
 *
 * This method is called when the <code>saveChanges</code>
 * method is invoked on the Message object containing this
 * Multipart. This is typically done as part of the Message
 * send process, however note that a client is free to call
 * it any number of times. So if the header updating process is 
 * expensive for a specific MimeMultipart subclass, then it
 * might itself want to track whether its internal state actually
 * did change, and do the header updating only if necessary.
 *
 * @exception    MessagingException for failures
 */
protected synchronized void updateHeaders() throws MessagingException {
parse();
for (int i = 0; i < parts.size(); i++)
  ((MimeBodyPart)parts.elementAt(i)).updateHeaders();
}

代码示例来源:origin: com.sun.mail/javax.mail

updateHeaders(this);

代码示例来源:origin: camunda/camunda-bpm-platform

updateHeaders(this);

代码示例来源:origin: camunda/camunda-bpm-platform

MimeBodyPart.updateHeaders(this);	
setHeader("MIME-Version", "1.0");
  updateMessageID();

代码示例来源:origin: com.sun.mail/javax.mail

MimeBodyPart.updateHeaders(this);	
setHeader("MIME-Version", "1.0");
if (getHeader("Date") == null)

代码示例来源:origin: javax.mail/javax.mail-api

/**
   * Force the <code>Content-Transfer-Encoding</code> header to use
   * the encoding that was specified when this object was created.
   */
  @Override
  protected void updateHeaders() throws MessagingException {
  super.updateHeaders();
  MimeBodyPart.setEncoding(this, encoding);
  }
}

代码示例来源:origin: javax.mail/com.springsource.javax.mail

/**
   * Force the <code>Content-Transfer-Encoding</code> header to use
   * the encoding that was specified when this object was created.
   */
  protected void updateHeaders() throws MessagingException {
  super.updateHeaders();
  MimeBodyPart.setEncoding(this, encoding);
  }
}

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.4_spec

protected void updateHeaders() throws MessagingException {
  parse();
  for (int i = 0; i < parts.size(); i++) {
    MimeBodyPart bodyPart = (MimeBodyPart) parts.get(i);
    bodyPart.updateHeaders();
  }
}

代码示例来源:origin: com.sun.mail/android-mail

/**
   * Force the <code>Content-Transfer-Encoding</code> header to use
   * the encoding that was specified when this object was created.
   */
  @Override
  protected void updateHeaders() throws MessagingException {
  super.updateHeaders();
  MimeBodyPart.setEncoding(this, encoding);
  }
}

代码示例来源:origin: com.sun.mail/mailapi

/**
   * Force the <code>Content-Transfer-Encoding</code> header to use
   * the encoding that was specified when this object was created.
   */
  @Override
  protected void updateHeaders() throws MessagingException {
  super.updateHeaders();
  MimeBodyPart.setEncoding(this, encoding);
  }
}

代码示例来源:origin: org.glassfish.metro/webservices-extra

/**
   * Force the <code>Content-Transfer-Encoding</code> header to use
   * the encoding that was specified when this object was created.
   */
  @Override
  protected void updateHeaders() throws MessagingException {
  super.updateHeaders();
  MimeBodyPart.setEncoding(this, encoding);
  }
}

代码示例来源:origin: i2p/i2p.i2p-bote

@Override
  public void updateHeaders() throws MessagingException {
    super.updateHeaders();
    setHeader("Content-Transfer-Encoding", "binary");
  }
};

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.4_spec

/**
   * Override of update headers to ensure the transfer encoding
   * is forced to the correct type.
   *
   * @exception MessagingException
   */
  protected void updateHeaders() throws MessagingException {
    super.updateHeaders();
    setHeader("Content-Transfer-Encoding", transferEncoding);
  }
}

代码示例来源:origin: jboss/jboss-javaee-specs

/**
   * Force the <code>Content-Transfer-Encoding</code> header to use
   * the encoding that was specified when this object was created.
   */
  @Override
  protected void updateHeaders() throws MessagingException {
  super.updateHeaders();
  MimeBodyPart.setEncoding(this, encoding);
  }
}

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.3.1_spec

protected void updateHeaders() throws MessagingException {
  parse();
  for (int i = 0; i < parts.size(); i++) {
    MimeBodyPart bodyPart = (MimeBodyPart) parts.get(i);
    bodyPart.updateHeaders();
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax.mail

/**
   * Force the <code>Content-Transfer-Encoding</code> header to use
   * the encoding that was specified when this object was created.
   */
  protected void updateHeaders() throws MessagingException {
  super.updateHeaders();
  MimeBodyPart.setEncoding(this, encoding);
  }
}

代码示例来源:origin: com.sun.mail/jakarta.mail

/**
   * Force the <code>Content-Transfer-Encoding</code> header to use
   * the encoding that was specified when this object was created.
   */
  @Override
  protected void updateHeaders() throws MessagingException {
  super.updateHeaders();
  MimeBodyPart.setEncoding(this, encoding);
  }
}

相关文章