public class SearchUtil extends Object
| Constructor and Description |
|---|
SearchUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
getBaseSubject(String subject)
Extract the base subject from the given subject.
|
static String |
getDisplayAddress(org.apache.james.mime4j.dom.address.Mailbox mailbox)
Return the DISPLAY ADDRESS for the given
Mailbox. |
static String |
getDisplayAddress(String headerValue)
Parse the headerValue and delegate to
getDisplayAddress(Mailbox)
If no display address is found an empty String is returned |
static String |
getMailboxAddress(org.apache.james.mime4j.dom.address.Mailbox mailbox)
Return addr-mailbox of the first "From" address.
|
static String |
getMailboxAddress(String headerValue)
Parse the headerValue and delegate to
getMailboxAddress(Mailbox)
If no mailbox name is found an empty String is returned |
public static String getDisplayAddress(org.apache.james.mime4j.dom.address.Mailbox mailbox)
Mailbox.
See rfc5957 3. DISPLAY Sort Value for an Address for the details
For the purposes of the sort criteria defined in this document, the
sort value for an [IMAP] address structure is defined as follows:
o If the address structure's [IMAP] addr-name is non-NIL, apply the procedure from [RFC5255], Section 4.6. (That is, decode any RFC2047] encoded-words and convert the resulting character string into a charset valid for the currently active [RFC4790] collation, with a default of UTF-8.) If the resulting octet string is not the empty string, use it as the sort value for the address.
o Otherwise, if the address structure's [IMAP] addr-mailbox and [IMAP] addr-host are both non-NIL, the sort value for the address is addr-mailbox@addr-host.
o Otherwise, if the address structure's [IMAP] addr-mailbox is non- NIL, the sort value for the address is its addr-mailbox.
o If none of the above conditions are met, the sort value for the address is the empty string.
mailbox - public static String getDisplayAddress(String headerValue)
getDisplayAddress(Mailbox)
If no display address is found an empty String is returnedheaderValue - public static String getMailboxAddress(org.apache.james.mime4j.dom.address.Mailbox mailbox)
mailbox - public static String getMailboxAddress(String headerValue)
getMailboxAddress(Mailbox)
If no mailbox name is found an empty String is returnedheaderValue - public static String getBaseSubject(String subject)
(1) Convert any RFC 2047 encoded-words in the subject to [UTF-8] as described in "Internationalization Considerations". Convert all tabs and continuations to space. Convert all multiple spaces to a single space.
(2) Remove all trailing text of the subject that matches the subj-trailer ABNF; repeat until no more matches are possible.
(3) Remove all prefix text of the subject that matches the subj- leader ABNF.
(4) If there is prefix text of the subject that matches the subj- blob ABNF, and removing that prefix leaves a non-empty subj- base, then remove the prefix text.
(5) Repeat (3) and (4) until no matches remain.
Note: It is possible to defer step (2) until step (6), but this requires checking for subj-trailer in step (4).(6) If the resulting text begins with the subj-fwd-hdr ABNF and ends with the subj-fwd-trl ABNF, remove the subj-fwd-hdr and subj-fwd-trl and repeat from step (2).
(7) The resulting text is the "base subject" used in the SORT.
subject - Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.