javax.mail.Header.getName()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(130)

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

Header.getName介绍

[英]Returns the name of this header.
[中]返回此标头的名称。

代码示例

代码示例来源:origin: oblac/jodd

/**
 * Sets headers.
 *
 * @param headersToSet Headers to set.
 * @return this
 * @see #header(String, String)
 */
public T headers(final Enumeration<Header> headersToSet) {
  while (headersToSet.hasMoreElements()) {
    final Header header = headersToSet.nextElement();
    header(header.getName(), header.getValue());
  }
  return _this();
}

代码示例来源:origin: apache/nifi

Header header = (Header) headers.nextElement();
if (StringUtils.isNotEmpty(header.getValue())
    && capturedHeadersList.contains(header.getName().toLowerCase())) {
  attributes.put("email.headers." + header.getName().toLowerCase(), header.getValue());

代码示例来源:origin: spring-projects/spring-integration

if (headerInstance instanceof Header) {
  Header header = (Header) headerInstance;
  rawHeaders.add(header.getName(), header.getValue());

代码示例来源:origin: resteasy/Resteasy

mimeHeaders.add(header.getName(), header.getValue());

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

while (e.hasMoreElements()) {
Header he = e.nextElement();
if (!isHeaderLoaded(he.getName()))
  headers.addHeader(
    he.getName(), he.getValue());

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

while (e.hasMoreElements()) {
Header he = e.nextElement();
if (!isHeaderLoaded(he.getName()))
  headers.addHeader(
    he.getName(), he.getValue());

代码示例来源:origin: org.alfresco/alfresco-repository

private boolean isPersistableHeader(Header header)
{
  for (String headerToPersist : messageHeadersToPersist)
  {
    if (headerToPersist.equalsIgnoreCase(header.getName()))
    {
      return true;
    }
  }
  return false; 
}

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

public Object nextElement() {
    Header h = (Header) headers.nextElement();
    return h.getName() + ": " + h.getValue();
  }
}

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

public Object nextElement() {
    Header h = (Header) headers.nextElement();
    return h.getName() + ": " + h.getValue();
  }
}

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_mail

private void writeHeaders(Enumeration<Header> headers, StringBuilder sb) {
  while (headers.hasMoreElements()) {
    Header header = headers.nextElement();
    sb.append(header.getName());
    sb.append(": ");
    sb.append(header.getValue());
    sb.append("\n");
  }
}

代码示例来源:origin: org.nhind/direct-common

protected String headersToString(Enumeration<Header> originalMessageHeaders) 
  {
    final StringBuffer sb = new StringBuffer();
    while (originalMessageHeaders.hasMoreElements()) 
    {
      Header h = originalMessageHeaders.nextElement();
      sb.append(StringEscapeUtils.escapeHtml4(h.getName() + ": " + h.getValue()));
      sb.append("<br/>");
    }
    return sb.toString();
  }
}

代码示例来源:origin: com.gitlab.jhonsapp/simple-email

public static List<Header> getHeaders(Enumeration<?> allHeaders) {
  List<Header> result = new LinkedList<Header>();
  while (allHeaders.hasMoreElements()) {
    javax.mail.Header h = (javax.mail.Header) allHeaders.nextElement();
    result.add(new Header(h.getName(), h.getValue()));
  }
  return result;
}

代码示例来源:origin: org.apache.james/james-server-jmap

private List<Header> getContentHeadersFromMimeMessage(MimeMessage mimeMessage) throws MessagingException {
  return Collections.list(mimeMessage.getAllHeaders())
    .stream()
    .filter(header -> header.getName().startsWith(CONTENT_HEADER_PREFIX))
    .collect(Guavate.toImmutableList());
}

代码示例来源:origin: com.mgmtp.jfunk/jfunk-core

private static ListMultimap<String, String> createHeaders(final Message message) throws MessagingException {
  ListMultimap<String, String> headers = ArrayListMultimap.create();
  for (@SuppressWarnings("unchecked")
  Enumeration<Header> headersEnum = message.getAllHeaders(); headersEnum.hasMoreElements();) {
    Header header = headersEnum.nextElement();
    headers.put(header.getName(), header.getValue());
  }
  return headers;
}

代码示例来源:origin: org.apache.james/apache-mailet-icalendar

private String computeBodyFromOriginalCalendar(BodyPart bodyPart) throws MessagingException {
  return headerStream(bodyPart)
    .map(header -> header.getName() + ": " + header.getValue())
    .collect(Collectors.joining("\r\n"));
}

代码示例来源:origin: org.apache.james/james-server-mailets

private void clearAllHeaders(MimeMessage message) throws javax.mail.MessagingException {
  Enumeration<Header> headers = message.getAllHeaders();
  while (headers.hasMoreElements()) {
    Header header = headers.nextElement();
    try {
      message.removeHeader(header.getName());
    } catch (MessagingException me) {
      LOGGER.error("Ignored error while removing header", me);
    }
  }
  message.saveChanges();
}

代码示例来源:origin: org.codemonkey.simplejavamail/simple-java-mail

private void extractCustomUserHeaders(MimePart part) throws MessagingException {
  Enumeration e = part.getAllHeaders();
  while (e.hasMoreElements()) {
    Object headerObj = e.nextElement();
    if (headerObj instanceof Header) {
      Header header = (Header) headerObj;
      if (isCustomUserHeader(header)) {
        headers.put(header.getName(), header.getValue());
      }
    }
  }
}

代码示例来源:origin: org.mnode.mstor/mstor

/**
   * {@inheritDoc}
   */
  protected Object createObject() {
    InternetHeaders internetHeaders = new InternetHeaders();
    for (Header header : ((List<Header>) values.get("headers"))) {
      internetHeaders.setHeader(header.getName(), header.getValue());
    }
    return internetHeaders;
  }
}

代码示例来源:origin: org.apache.james/james-server-jmap

private MimeBodyPart createMimeBodyPartWithContentHeadersFromMimeMessage(MimeMessage mimeMessage, List<Header> contentHeaders) throws MessagingException {
  MimeBodyPart fileBody = new MimeBodyPart(mimeMessage.getRawInputStream());
  for (Header header : contentHeaders) {
    fileBody.setHeader(header.getName(), header.getValue());
  }
  fileBody.setDisposition(Part.ATTACHMENT);
  return fileBody;
}

代码示例来源:origin: com.gitlab.jhonsapp/simple-email

@Override
protected void updateMessageID() throws MessagingException {
  Header header = new Header("Message-ID", messageId);
  setHeader(header.getName(), header.getValue());
}

相关文章