本文整理了Java中javax.mail.Header
类的一些代码示例,展示了Header
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Header
类的具体详情如下:
包路径:javax.mail.Header
类名称:Header
[英]The Header class stores a name/value pair to represent headers.
[中]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: pentaho/pentaho-kettle
when( message.getSize() ).thenReturn( CNTNT_SIZE );
Header ex1 = new Header( HDR_EX1, HDR_EX1V );
Header ex2 = new Header( HDR_EX2, HDR_EX2V );
when( message.getHeader( eq( HDR_EX1 ) ) ).thenReturn( new String[] { ex1.getValue() } );
when( message.getHeader( eq( HDR_EX2 ) ) ).thenReturn( new String[] { ex2.getValue() } );
代码示例来源:origin: org.springframework.ws/spring-ws-support
@Override
public Iterator<String> getRequestHeaderNames() throws IOException {
try {
List<String> headers = new ArrayList<String>();
Enumeration<?> enumeration = requestMessage.getAllHeaders();
while (enumeration.hasMoreElements()) {
Header header = (Header) enumeration.nextElement();
headers.add(header.getName());
}
return headers.iterator();
}
catch (MessagingException ex) {
throw new IOException(ex.getMessage());
}
}
代码示例来源:origin: org.apache.axis/axis
new javax.mail.internet.InternetHeaders(
boundaryDelimitedStream);
contentId = headers.getHeader("Content-Id", null);
headers.getHeader(HTTPConstants.HEADER_CONTENT_TYPE,
null);
HTTPConstants.HEADER_CONTENT_ID,
HTTPConstants.HEADER_CONTENT_LOCATION,
HTTPConstants.HEADER_CONTENT_TYPE}); en.hasMoreElements();) {
javax.mail.Header header =
(javax.mail.Header) en.nextElement();
String name = header.getName();
String value = header.getValue();
代码示例来源:origin: pentaho/pentaho-kettle
while ( en.hasMoreElements() ) {
Header next = Header.class.cast( en.nextElement() );
headers.add( next.getValue() );
代码示例来源:origin: org.apache.geronimo.javamail/geronimo-javamail_1.4_provider
Enumeration e = headers.getAllHeaders();
while (e.hasMoreElements()) {
Header header = (Header)e.nextElement();
if (newHeaders.getHeader(header.getName()) == null) {
String name = header.getName();
String[] a = headers.getHeader(name);
for (int i = 0; i < a.length; i++) {
newHeaders.addHeader(name, a[i]);
代码示例来源: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.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.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.alfresco/alfresco-repository
private boolean isPersistableHeader(Header header)
{
for (String headerToPersist : messageHeadersToPersist)
{
if (headerToPersist.equalsIgnoreCase(header.getName()))
{
return true;
}
}
return false;
}
代码示例来源:origin: com.gitlab.jhonsapp/simple-email
@Override
protected void updateMessageID() throws MessagingException {
Header header = new Header("Message-ID", messageId);
setHeader(header.getName(), header.getValue());
}
代码示例来源: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.apache.geronimo.specs/geronimo-javamail_1.3.1_spec
List list = getHeaderList(lastHeaderName);
Header h = (Header) list.remove(list.size() - 1);
list.add(new InternetHeader(lastHeaderName, (h.getValue() + value.toString()).trim()));
} else {
lastHeaderName = name.toString().trim();
addHeader(lastHeaderName, value.toString().trim());
代码示例来源:origin: camunda/camunda-bpm-platform
public Object nextElement() {
if (next_header == null)
next_header = nextMatch();
if (next_header == null)
throw new NoSuchElementException("No more headers");
InternetHeader h = next_header;
next_header = null;
if (want_line)
return h.line;
else
return new Header(h.getName(), h.getValue());
}
代码示例来源:origin: spring-projects/spring-ws
@Override
public Iterator<String> getRequestHeaderNames() throws IOException {
try {
List<String> headers = new ArrayList<String>();
Enumeration<?> enumeration = requestMessage.getAllHeaders();
while (enumeration.hasMoreElements()) {
Header header = (Header) enumeration.nextElement();
headers.add(header.getName());
}
return headers.iterator();
}
catch (MessagingException ex) {
throw new IOException(ex.getMessage());
}
}
代码示例来源:origin: axis/axis
new javax.mail.internet.InternetHeaders(
boundaryDelimitedStream);
contentId = headers.getHeader("Content-Id", null);
headers.getHeader(HTTPConstants.HEADER_CONTENT_TYPE,
null);
HTTPConstants.HEADER_CONTENT_ID,
HTTPConstants.HEADER_CONTENT_LOCATION,
HTTPConstants.HEADER_CONTENT_TYPE}); en.hasMoreElements();) {
javax.mail.Header header =
(javax.mail.Header) en.nextElement();
String name = header.getName();
String value = header.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.simplejavamail/simple-java-mail
@SuppressWarnings("StatementWithEmptyBody")
private static void parseHeader(final Header header, @Nonnull final ParsedMimeMessageComponents parsedComponents) {
if (header.getName().equals("Disposition-Notification-To")) {
parsedComponents.dispositionNotificationTo = createAddress(header, "Disposition-Notification-To");
} else if (header.getName().equals("Return-Receipt-To")) {
parsedComponents.returnReceiptTo = createAddress(header, "Return-Receipt-To");
} else if (header.getName().equals("Return-Path")) {
parsedComponents.bounceToAddress = createAddress(header, "Return-Path");
} else if (!HEADERS_TO_IGNORE.contains(header.getName())) {
parsedComponents.headers.put(header.getName(), header.getValue());
} else {
// header recognized, but not relevant (see #HEADERS_TO_IGNORE)
}
}
代码示例来源:origin: Alfresco/alfresco-repository
private boolean isPersistableHeader(Header header)
{
for (String headerToPersist : messageHeadersToPersist)
{
if (headerToPersist.equalsIgnoreCase(header.getName()))
{
return true;
}
}
return false;
}
代码示例来源:origin: org.mnode.mstor/mstor
public Object getProperty(Object obj, String name) {
if ("value".equals(name)) {
return ((Header) obj).getValue().replaceAll("\\x1F|\\x0C", "");
}
return super.getProperty(obj, name);
}
内容来源于网络,如有侵权,请联系作者删除!