本文整理了Java中javax.mail.internet.MimeMessage.isStrictAddressing()
方法的一些代码示例,展示了MimeMessage.isStrictAddressing()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MimeMessage.isStrictAddressing()
方法的具体详情如下:
包路径:javax.mail.internet.MimeMessage
类名称:MimeMessage
方法名:isStrictAddressing
[英]Check to see if we require strict addressing on parsing internet headers.
[中]
代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.3.1_spec
/**
* Return the "Sender" header as an address.
*
* @return the "Sender" header as an address, or null if not present
* @throws MessagingException if there was a problem parsing the header
*/
public Address getSender() throws MessagingException {
Address[] addrs = getHeaderAsInternetAddresses("Sender", isStrictAddressing());
return addrs.length > 0 ? addrs[0] : null;
}
代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.4_spec
/**
* Return the "Sender" header as an address.
*
* @return the "Sender" header as an address, or null if not present
* @throws MessagingException if there was a problem parsing the header
*/
public Address getSender() throws MessagingException {
Address[] addrs = getHeaderAsInternetAddresses("Sender", isStrictAddressing());
return addrs != null && addrs.length > 0 ? addrs[0] : null;
}
代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.3.1_spec
/**
* Get the ReplyTo address information. The headers are parsed
* using the "mail.mime.address.strict" setting. If the "Reply-To" header does
* not have any addresses, then the value of the "From" field is used.
*
* @return An array of addresses obtained from parsing the header.
* @exception MessagingException
*/
public Address[] getReplyTo() throws MessagingException {
Address[] addresses = getHeaderAsInternetAddresses("Reply-To", isStrictAddressing());
if (addresses == null) {
addresses = getFrom();
}
return addresses;
}
代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.4_spec
/**
* Get the ReplyTo address information. The headers are parsed
* using the "mail.mime.address.strict" setting. If the "Reply-To" header does
* not have any addresses, then the value of the "From" field is used.
*
* @return An array of addresses obtained from parsing the header.
* @exception MessagingException
*/
public Address[] getReplyTo() throws MessagingException {
Address[] addresses = getHeaderAsInternetAddresses("Reply-To", isStrictAddressing());
if (addresses == null) {
addresses = getFrom();
}
return addresses;
}
代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.4_spec
/**
* Get the message "From" addresses. This looks first at the
* "From" headers, and no "From" header is found, the "Sender"
* header is checked. Returns null if not found.
*
* @return An array of addresses identifying the message from target. Returns
* null if this is not resolveable from the headers.
* @exception MessagingException
*/
public Address[] getFrom() throws MessagingException {
// strict addressing controls this.
boolean strict = isStrictAddressing();
Address[] result = getHeaderAsInternetAddresses("From", strict);
if (result == null) {
result = getHeaderAsInternetAddresses("Sender", strict);
}
return result;
}
代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.3.1_spec
/**
* Get the message "From" addresses. This looks first at the
* "From" headers, and no "From" header is found, the "Sender"
* header is checked. Returns null if not found.
*
* @return An array of addresses identifying the message from target. Returns
* null if this is not resolveable from the headers.
* @exception MessagingException
*/
public Address[] getFrom() throws MessagingException {
// strict addressing controls this.
boolean strict = isStrictAddressing();
Address[] result = getHeaderAsInternetAddresses("From", strict);
if (result == null) {
result = getHeaderAsInternetAddresses("Sender", strict);
}
return result;
}
代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.4_spec
/**
* Utility routine to merge different recipient types into a
* single list.
*
* @param list The accumulator list.
* @param type The recipient type to extract.
*
* @exception MessagingException
*/
private void addRecipientsToList(List list, Message.RecipientType type) throws MessagingException {
Address[] recipients;
if (type == RecipientType.NEWSGROUPS) {
recipients = getHeaderAsNewsAddresses(getHeaderForRecipientType(type));
}
else {
recipients = getHeaderAsInternetAddresses(getHeaderForRecipientType(type), isStrictAddressing());
}
if (recipients != null) {
list.addAll(Arrays.asList(recipients));
}
}
代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.3.1_spec
/**
* Utility routine to merge different recipient types into a
* single list.
*
* @param list The accumulator list.
* @param type The recipient type to extract.
*
* @exception MessagingException
*/
private void addRecipientsToList(List list, Message.RecipientType type) throws MessagingException {
Address[] recipients;
if (type == RecipientType.NEWSGROUPS) {
recipients = getHeaderAsNewsAddresses(getHeaderForRecipientType(type));
}
else {
recipients = getHeaderAsInternetAddresses(getHeaderForRecipientType(type), isStrictAddressing());
}
if (recipients != null) {
list.addAll(Arrays.asList(recipients));
}
}
代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.4_spec
/**
* Gets the recipients by type. Returns null if there are no
* headers of the specified type. Acceptable RecipientTypes are:
*
* javax.mail.Message.RecipientType.TO
* javax.mail.Message.RecipientType.CC
* javax.mail.Message.RecipientType.BCC
* javax.mail.internet.MimeMessage.RecipientType.NEWSGROUPS
*
* @param type The message RecipientType identifier.
*
* @return The array of addresses for the specified recipient types.
* @exception MessagingException
*/
public Address[] getRecipients(Message.RecipientType type) throws MessagingException {
// is this a NEWSGROUP request? We need to handle this as a special case here, because
// this needs to return NewsAddress instances instead of InternetAddress items.
if (type == RecipientType.NEWSGROUPS) {
return getHeaderAsNewsAddresses(getHeaderForRecipientType(type));
}
// the other types are all internet addresses.
return getHeaderAsInternetAddresses(getHeaderForRecipientType(type), isStrictAddressing());
}
代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.3.1_spec
/**
* Gets the recipients by type. Returns null if there are no
* headers of the specified type. Acceptable RecipientTypes are:
*
* javax.mail.Message.RecipientType.TO
* javax.mail.Message.RecipientType.CC
* javax.mail.Message.RecipientType.BCC
* javax.mail.internet.MimeMessage.RecipientType.NEWSGROUPS
*
* @param type The message RecipientType identifier.
*
* @return The array of addresses for the specified recipient types.
* @exception MessagingException
*/
public Address[] getRecipients(Message.RecipientType type) throws MessagingException {
// is this a NEWSGROUP request? We need to handle this as a special case here, because
// this needs to return NewsAddress instances instead of InternetAddress items.
if (type == RecipientType.NEWSGROUPS) {
return getHeaderAsNewsAddresses(getHeaderForRecipientType(type));
}
// the other types are all internet addresses.
return getHeaderAsInternetAddresses(getHeaderForRecipientType(type), isStrictAddressing());
}
内容来源于网络,如有侵权,请联系作者删除!