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

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

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

MimeBodyPart.removeHeader介绍

[英]Remove all headers with this name.
[中]删除所有具有此名称的标题。

代码示例

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

  1. /**
  2. * Set the "Content-ID" header field of this body part.
  3. * If the <code>cid</code> parameter is null, any existing
  4. * "Content-ID" is removed.
  5. *
  6. * @param cid the Content-ID
  7. * @exception IllegalWriteException if the underlying
  8. * implementation does not support modification
  9. * @exception IllegalStateException if this body part is
  10. * obtained from a READ_ONLY folder.
  11. * @exception MessagingException for other failures
  12. * @since JavaMail 1.3
  13. */
  14. public void setContentID(String cid) throws MessagingException {
  15. if (cid == null)
  16. removeHeader("Content-ID");
  17. else
  18. setHeader("Content-ID", cid);
  19. }

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

  1. /**
  2. * Set the "Content-ID" header field of this body part.
  3. * If the <code>cid</code> parameter is null, any existing
  4. * "Content-ID" is removed.
  5. *
  6. * @param cid the Content-ID
  7. * @exception IllegalWriteException if the underlying
  8. * implementation does not support modification
  9. * @exception IllegalStateException if this body part is
  10. * obtained from a READ_ONLY folder.
  11. * @exception MessagingException for other failures
  12. * @since JavaMail 1.3
  13. */
  14. public void setContentID(String cid) throws MessagingException {
  15. if (cid == null)
  16. removeHeader("Content-ID");
  17. else
  18. setHeader("Content-ID", cid);
  19. }

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

  1. public void setDataHandler(DataHandler handler) throws MessagingException {
  2. dh = handler;
  3. // if we have a handler override, then we need to invalidate any content
  4. // headers that define the types. This information will be derived from the
  5. // data heander unless subsequently overridden.
  6. removeHeader("Content-Type");
  7. removeHeader("Content-Transfer-Encoding");
  8. }

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

  1. public void setDataHandler(DataHandler handler) throws MessagingException {
  2. dh = handler;
  3. // if we have a handler override, then we need to invalidate any content
  4. // headers that define the types. This information will be derived from the
  5. // data heander unless subsequently overridden.
  6. removeHeader("Content-Type");
  7. removeHeader("Content-Transfer-Encoding");
  8. }

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

  1. /**
  2. * Set the "Content-ID" header field of this body part.
  3. * If the <code>cid</code> parameter is null, any existing
  4. * "Content-ID" is removed.
  5. *
  6. * @param cid the Content-ID
  7. * @exception IllegalWriteException if the underlying
  8. * implementation does not support modification
  9. * @exception IllegalStateException if this body part is
  10. * obtained from a READ_ONLY folder.
  11. * @exception MessagingException for other failures
  12. * @since JavaMail 1.3
  13. */
  14. public void setContentID(String cid) throws MessagingException {
  15. if (cid == null)
  16. removeHeader("Content-ID");
  17. else
  18. setHeader("Content-ID", cid);
  19. }

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

  1. /**
  2. * Set the "Content-ID" header field of this body part.
  3. * If the <code>cid</code> parameter is null, any existing
  4. * "Content-ID" is removed.
  5. *
  6. * @param cid the Content-ID
  7. * @exception IllegalWriteException if the underlying
  8. * implementation does not support modification
  9. * @exception IllegalStateException if this body part is
  10. * obtained from a READ_ONLY folder.
  11. * @exception MessagingException for other failures
  12. * @since JavaMail 1.3
  13. */
  14. public void setContentID(String cid) throws MessagingException {
  15. if (cid == null)
  16. removeHeader("Content-ID");
  17. else
  18. setHeader("Content-ID", cid);
  19. }

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

  1. /**
  2. * Set the "Content-ID" header field of this body part.
  3. * If the <code>cid</code> parameter is null, any existing
  4. * "Content-ID" is removed.
  5. *
  6. * @exception IllegalWriteException if the underlying
  7. * implementation does not support modification
  8. * @exception IllegalStateException if this body part is
  9. * obtained from a READ_ONLY folder.
  10. * @exception MessagingException
  11. * @since JavaMail 1.3
  12. */
  13. public void setContentID(String cid) throws MessagingException {
  14. if (cid == null)
  15. removeHeader("Content-ID");
  16. else
  17. setHeader("Content-ID", cid);
  18. }

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

  1. /**
  2. * Set the "Content-ID" header field of this body part.
  3. * If the <code>cid</code> parameter is null, any existing
  4. * "Content-ID" is removed.
  5. *
  6. * @exception IllegalWriteException if the underlying
  7. * implementation does not support modification
  8. * @exception IllegalStateException if this body part is
  9. * obtained from a READ_ONLY folder.
  10. * @exception MessagingException
  11. * @since JavaMail 1.3
  12. */
  13. public void setContentID(String cid) throws MessagingException {
  14. if (cid == null)
  15. removeHeader("Content-ID");
  16. else
  17. setHeader("Content-ID", cid);
  18. }

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

  1. /**
  2. * Set the "Content-ID" header field of this body part.
  3. * If the <code>cid</code> parameter is null, any existing
  4. * "Content-ID" is removed.
  5. *
  6. * @param cid the Content-ID
  7. * @exception IllegalWriteException if the underlying
  8. * implementation does not support modification
  9. * @exception IllegalStateException if this body part is
  10. * obtained from a READ_ONLY folder.
  11. * @exception MessagingException for other failures
  12. * @since JavaMail 1.3
  13. */
  14. public void setContentID(String cid) throws MessagingException {
  15. if (cid == null)
  16. removeHeader("Content-ID");
  17. else
  18. setHeader("Content-ID", cid);
  19. }

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

  1. public void setContentLanguage(String[] languages) throws MessagingException {
  2. if (languages == null) {
  3. removeHeader("Content-Language");
  4. } else if (languages.length == 1) {
  5. setHeader("Content-Language", languages[0]);
  6. } else {
  7. StringBuffer buf = new StringBuffer(languages.length * 20);
  8. buf.append(languages[0]);
  9. for (int i = 1; i < languages.length; i++) {
  10. buf.append(',').append(languages[i]);
  11. }
  12. setHeader("Content-Language", buf.toString());
  13. }
  14. }

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

  1. /**
  2. * Set the "Content-ID" header field of this body part.
  3. * If the <code>cid</code> parameter is null, any existing
  4. * "Content-ID" is removed.
  5. *
  6. * @param cid the Content-ID
  7. * @exception IllegalWriteException if the underlying
  8. * implementation does not support modification
  9. * @exception IllegalStateException if this body part is
  10. * obtained from a READ_ONLY folder.
  11. * @exception MessagingException for other failures
  12. * @since JavaMail 1.3
  13. */
  14. public void setContentID(String cid) throws MessagingException {
  15. if (cid == null)
  16. removeHeader("Content-ID");
  17. else
  18. setHeader("Content-ID", cid);
  19. }

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

  1. public void setContentLanguage(String[] languages) throws MessagingException {
  2. if (languages == null) {
  3. removeHeader("Content-Language");
  4. } else if (languages.length == 1) {
  5. setHeader("Content-Language", languages[0]);
  6. } else {
  7. StringBuffer buf = new StringBuffer(languages.length * 20);
  8. buf.append(languages[0]);
  9. for (int i = 1; i < languages.length; i++) {
  10. buf.append(',').append(languages[i]);
  11. }
  12. setHeader("Content-Language", buf.toString());
  13. }
  14. }

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

  1. /**
  2. * Set the "Content-ID" header field of this body part.
  3. * If the <code>cid</code> parameter is null, any existing
  4. * "Content-ID" is removed.
  5. *
  6. * @param cid the Content-ID
  7. * @exception IllegalWriteException if the underlying
  8. * implementation does not support modification
  9. * @exception IllegalStateException if this body part is
  10. * obtained from a READ_ONLY folder.
  11. * @exception MessagingException for other failures
  12. * @since JavaMail 1.3
  13. */
  14. public void setContentID(String cid) throws MessagingException {
  15. if (cid == null)
  16. removeHeader("Content-ID");
  17. else
  18. setHeader("Content-ID", cid);
  19. }

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

  1. /**
  2. * Set the "Content-ID" header field of this body part.
  3. * If the <code>cid</code> parameter is null, any existing
  4. * "Content-ID" is removed.
  5. *
  6. * @param cid the Content-ID
  7. * @exception IllegalWriteException if the underlying
  8. * implementation does not support modification
  9. * @exception IllegalStateException if this body part is
  10. * obtained from a READ_ONLY folder.
  11. * @exception MessagingException for other failures
  12. * @since JavaMail 1.3
  13. */
  14. public void setContentID(String cid) throws MessagingException {
  15. if (cid == null)
  16. removeHeader("Content-ID");
  17. else
  18. setHeader("Content-ID", cid);
  19. }

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

  1. public void setDescription(String description, String charset) throws MessagingException {
  2. if (description == null) {
  3. removeHeader("Content-Description");
  4. }
  5. else {
  6. try {
  7. setHeader("Content-Description", MimeUtility.fold(21, MimeUtility.encodeText(description, charset, null)));
  8. } catch (UnsupportedEncodingException e) {
  9. throw new MessagingException(e.getMessage(), e);
  10. }
  11. }
  12. }

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

  1. public void setDescription(String description, String charset) throws MessagingException {
  2. if (description == null) {
  3. removeHeader("Content-Description");
  4. }
  5. else {
  6. try {
  7. setHeader("Content-Description", ASCIIUtil.fold(21, MimeUtility.encodeText(description, charset, null)));
  8. } catch (UnsupportedEncodingException e) {
  9. throw new MessagingException(e.getMessage(), e);
  10. }
  11. }
  12. }

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

  1. /**
  2. * Set a new dispostion value for the "Content-Disposition" field.
  3. * If the new value is null, the header is removed.
  4. *
  5. * @param disposition
  6. * The new disposition value.
  7. *
  8. * @exception MessagingException
  9. */
  10. public void setDisposition(String disposition) throws MessagingException {
  11. if (disposition == null) {
  12. removeHeader("Content-Disposition");
  13. }
  14. else {
  15. // the disposition has parameters, which we'll attempt to preserve in any existing header.
  16. String currentHeader = getSingleHeader("Content-Disposition");
  17. if (currentHeader != null) {
  18. ContentDisposition content = new ContentDisposition(currentHeader);
  19. content.setDisposition(disposition);
  20. setHeader("Content-Disposition", content.toString());
  21. }
  22. else {
  23. // set using the raw string.
  24. setHeader("Content-Disposition", disposition);
  25. }
  26. }
  27. }

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

  1. /**
  2. * Set a new dispostion value for the "Content-Disposition" field.
  3. * If the new value is null, the header is removed.
  4. *
  5. * @param disposition
  6. * The new disposition value.
  7. *
  8. * @exception MessagingException
  9. */
  10. public void setDisposition(String disposition) throws MessagingException {
  11. if (disposition == null) {
  12. removeHeader("Content-Disposition");
  13. }
  14. else {
  15. // the disposition has parameters, which we'll attempt to preserve in any existing header.
  16. String currentHeader = getSingleHeader("Content-Disposition");
  17. if (currentHeader != null) {
  18. ContentDisposition content = new ContentDisposition(currentHeader);
  19. content.setDisposition(disposition);
  20. setHeader("Content-Disposition", content.toString());
  21. }
  22. else {
  23. // set using the raw string.
  24. setHeader("Content-Disposition", disposition);
  25. }
  26. }
  27. }

代码示例来源:origin: gitblit/fathom

  1. mimeBodyPart.removeHeader(entry.getKey());
  2. } else {
  3. mimeBodyPart.setHeader(entry.getKey(), entry.getValue());

代码示例来源:origin: com.gitblit.fathom/fathom-mailer

  1. mimeBodyPart.removeHeader(entry.getKey());
  2. } else {
  3. mimeBodyPart.setHeader(entry.getKey(), entry.getValue());

相关文章