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

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

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

Header.getValue介绍

[英]Returns the value 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

while (headers.hasMoreElements()) {
  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: pentaho/pentaho-kettle

while ( en.hasMoreElements() ) {
 Header next = Header.class.cast( en.nextElement() );
 headers.add( next.getValue() );

代码示例来源:origin: pentaho/pentaho-kettle

when( message.getHeader( eq( HDR_EX1 ) ) ).thenReturn( new String[] { ex1.getValue() } );
when( message.getHeader( eq( HDR_EX2 ) ) ).thenReturn( new String[] { ex2.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

if (!isHeaderLoaded(he.getName()))
  headers.addHeader(
    he.getName(), he.getValue());

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

if (!isHeaderLoaded(he.getName()))
  headers.addHeader(
    he.getName(), he.getValue());

代码示例来源: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: juandesi/email4j

/**
 * Parses all the {@link Message} headers to a {@link Map}
 */
private Multimap<String, String> parseHeaders(Enumeration headers) {
 ImmutableMultimap.Builder<String, String> builder = ImmutableMultimap.builder();
 while (headers.hasMoreElements()) {
  Header header = (Header) headers.nextElement();
  builder.put(header.getName(), header.getValue());
 }
 return builder.build();
}

代码示例来源:origin: DirectProject/nhin-d

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

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

@Nonnull
private static InternetAddress createAddress(final Header header, final String typeOfAddress) {
  try {
    return new InternetAddress(header.getValue());
  } catch (final AddressException e) {
    throw new MimeMessageParseException(format(MimeMessageParseException.ERROR_PARSING_ADDRESS, typeOfAddress), e);
  }
}

代码示例来源: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/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.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.apache.james/james-server-mailets

private void copyRelevantHeaders(MimeMessage originalMessage, MimeMessage newMessage) throws MessagingException {
  Enumeration<Header> headerEnum = originalMessage.getMatchingHeaders(
      new String[] { RFC2822Headers.DATE, RFC2822Headers.FROM, RFC2822Headers.REPLY_TO, RFC2822Headers.TO, 
          RFC2822Headers.SUBJECT, RFC2822Headers.RETURN_PATH });
  while (headerEnum.hasMoreElements()) {
    Header header = headerEnum.nextElement();
    newMessage.addHeader(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;
}

相关文章