StringTokenizer headerNamesParser;
Vector headerNames = null;
String hdrName;
String[] hdrValue;
StringBuffer hdrValueBuffer;
Header hdrObject;
/* Get all of the headers */
allHeaders = msg.getAllHeaders();
/* Build our headerlist (if passed in) */
if (headerlist != null) {
headerNames = new Vector();
headerNamesParser = new StringTokenizer(headerlist,", ");
while (headerNamesParser.hasMoreTokens()) {
headerNames.addElement(headerNamesParser.nextToken());
}
}
/* Go through the enumeration and put the requested headers into properties */
while (allHeaders.hasMoreElements()) {
hdrObject = (Header) allHeaders.nextElement();
/* Check to see if we are being asked for all headers, or a subset */
if (headerNames == null || headerNames.contains(hdrObject.getName())) {
hdrName = hdrObject.getName();
} else {
/* Not a header we asked for, go to the next header */
continue;
}