/** * Add an RFC822 header line to the header store. * If the line starts with a space or tab (a continuation line), * add it to the last header line in the list. Otherwise, * append the new header line to the list. <p> * * Note that RFC822 headers can only contain US-ASCII characters * * @param line raw RFC822 header line */ @SuppressWarnings("unchecked") public void addHeaderLine(String line) { try { char c = line.charAt(0); if (c == ' ' || c == '\t') { InternetHeader h = (InternetHeader)headers.get(headers.size() - 1); h.line += "\r\n" + line; } else headers.add(new InternetHeader(line)); } catch (StringIndexOutOfBoundsException e) { // line is empty, ignore it return; } catch (NoSuchElementException e) { // XXX - list is empty? } }
/** * Add an RFC822 header line to the header store. * If the line starts with a space or tab (a continuation line), * add it to the last header line in the list. Otherwise, * append the new header line to the list. <p> * * Note that RFC822 headers can only contain US-ASCII characters * * @param line raw RFC822 header line */ public void addHeaderLine(String line) { try { char c = line.charAt(0); if (c == ' ' || c == '\t') { InternetHeader h = headers.get(headers.size() - 1); h.line += "\r\n" + line; } else headers.add(new InternetHeader(line)); } catch (StringIndexOutOfBoundsException e) { // line is empty, ignore it return; } catch (NoSuchElementException e) { // XXX - list is empty? } }
pos = i; } else { headers.add(i + 1, new InternetHeader(name, value)); return; pos = i; headers.add(pos, new InternetHeader(name, value));
headers.add(new InternetHeader("Return-Path", null)); headers.add(new InternetHeader("Received", null)); headers.add(new InternetHeader("Resent-Date", null)); headers.add(new InternetHeader("Resent-From", null)); headers.add(new InternetHeader("Resent-Sender", null)); headers.add(new InternetHeader("Resent-To", null)); headers.add(new InternetHeader("Resent-Cc", null)); headers.add(new InternetHeader("Resent-Bcc", null)); headers.add(new InternetHeader("Resent-Message-Id", null)); headers.add(new InternetHeader("Date", null)); headers.add(new InternetHeader("From", null)); headers.add(new InternetHeader("Sender", null)); headers.add(new InternetHeader("Reply-To", null)); headers.add(new InternetHeader("To", null)); headers.add(new InternetHeader("Cc", null)); headers.add(new InternetHeader("Bcc", null)); headers.add(new InternetHeader("Message-Id", null)); headers.add(new InternetHeader("In-Reply-To", null)); headers.add(new InternetHeader("References", null)); headers.add(new InternetHeader("Subject", null)); headers.add(new InternetHeader("Comments", null)); headers.add(new InternetHeader("Keywords", null)); headers.add(new InternetHeader("Errors-To", null)); headers.add(new InternetHeader("MIME-Version", null)); headers.add(new InternetHeader("Content-Type", null)); headers.add(new InternetHeader("Content-Transfer-Encoding", null)); headers.add(new InternetHeader("Content-MD5", null)); headers.add(new InternetHeader(":", null)); headers.add(new InternetHeader("Content-Length", null));
headers.add(new InternetHeader(line));
/** * Add an RFC822 header line to the header store. * If the line starts with a space or tab (a continuation line), * add it to the last header line in the list. Otherwise, * append the new header line to the list. <p> * * Note that RFC822 headers can only contain US-ASCII characters * * @param line raw RFC822 header line */ public void addHeaderLine(String line) { try { char c = line.charAt(0); if (c == ' ' || c == '\t') { InternetHeader h = headers.get(headers.size() - 1); h.line += "\r\n" + line; } else headers.add(new InternetHeader(line)); } catch (StringIndexOutOfBoundsException e) { // line is empty, ignore it return; } catch (NoSuchElementException e) { // XXX - list is empty? } }
/** * Add an RFC822 header line to the header store. * If the line starts with a space or tab (a continuation line), * add it to the last header line in the list. Otherwise, * append the new header line to the list. <p> * * Note that RFC822 headers can only contain US-ASCII characters * * @param line raw RFC822 header line */ public void addHeaderLine(String line) { try { char c = line.charAt(0); if (c == ' ' || c == '\t') { InternetHeader h = (InternetHeader)headers.get(headers.size() - 1); h.line += "\r\n" + line; } else headers.add(new InternetHeader(line)); } catch (StringIndexOutOfBoundsException e) { // line is empty, ignore it return; } catch (NoSuchElementException e) { // XXX - vector is empty? } }
/** * Add an RFC822 header line to the header store. * If the line starts with a space or tab (a continuation line), * add it to the last header line in the list. Otherwise, * append the new header line to the list. <p> * * Note that RFC822 headers can only contain US-ASCII characters * * @param line raw RFC822 header line */ public void addHeaderLine(String line) { try { char c = line.charAt(0); if (c == ' ' || c == '\t') { InternetHeader h = headers.get(headers.size() - 1); h.line += "\r\n" + line; } else headers.add(new InternetHeader(line)); } catch (StringIndexOutOfBoundsException e) { // line is empty, ignore it return; } catch (NoSuchElementException e) { // XXX - list is empty? } }
/** * Add an RFC822 header line to the header store. * If the line starts with a space or tab (a continuation line), * add it to the last header line in the list. Otherwise, * append the new header line to the list. <p> * * Note that RFC822 headers can only contain US-ASCII characters * * @param line raw RFC822 header line */ public void addHeaderLine(String line) { try { char c = line.charAt(0); if (c == ' ' || c == '\t') { InternetHeader h = headers.get(headers.size() - 1); h.line += "\r\n" + line; } else headers.add(new InternetHeader(line)); } catch (StringIndexOutOfBoundsException e) { // line is empty, ignore it return; } catch (NoSuchElementException e) { // XXX - list is empty? } }
/** * Add an RFC822 header line to the header store. * If the line starts with a space or tab (a continuation line), * add it to the last header line in the list. Otherwise, * append the new header line to the list. <p> * * Note that RFC822 headers can only contain US-ASCII characters * * @param line raw RFC822 header line */ public void addHeaderLine(String line) { try { char c = line.charAt(0); if (c == ' ' || c == '\t') { InternetHeader h = headers.get(headers.size() - 1); h.line += "\r\n" + line; } else headers.add(new InternetHeader(line)); } catch (StringIndexOutOfBoundsException e) { // line is empty, ignore it return; } catch (NoSuchElementException e) { // XXX - list is empty? } }
/** * Add an RFC822 header line to the header store. * If the line starts with a space or tab (a continuation line), * add it to the last header line in the list. Otherwise, * append the new header line to the list. <p> * * Note that RFC822 headers can only contain US-ASCII characters * * @param line raw RFC822 header line */ public void addHeaderLine(String line) { try { char c = line.charAt(0); if (c == ' ' || c == '\t') { InternetHeader h = (InternetHeader)headers.get(headers.size() - 1); h.line += "\r\n" + line; } else headers.add(new InternetHeader(line)); } catch (StringIndexOutOfBoundsException e) { // line is empty, ignore it return; } catch (NoSuchElementException e) { // XXX - vector is empty? } }
/** * Add an RFC822 header line to the header store. * If the line starts with a space or tab (a continuation line), * add it to the last header line in the list. Otherwise, * append the new header line to the list. <p> * * Note that RFC822 headers can only contain US-ASCII characters * * @param line raw RFC822 header line */ public void addHeaderLine(String line) { try { char c = line.charAt(0); if (c == ' ' || c == '\t') { InternetHeader h = headers.get(headers.size() - 1); h.line += "\r\n" + line; } else headers.add(new InternetHeader(line)); } catch (StringIndexOutOfBoundsException e) { // line is empty, ignore it return; } catch (NoSuchElementException e) { // XXX - list is empty? } }
/** * Add an RFC822 header line to the header store. * If the line starts with a space or tab (a continuation line), * add it to the last header line in the list. Otherwise, * append the new header line to the list. <p> * * Note that RFC822 headers can only contain US-ASCII characters * * @param line raw RFC822 header line */ public void addHeaderLine(String line) { try { char c = line.charAt(0); if (c == ' ' || c == '\t') { InternetHeader h = headers.get(headers.size() - 1); h.line += "\r\n" + line; } else headers.add(new InternetHeader(line)); } catch (StringIndexOutOfBoundsException e) { // line is empty, ignore it return; } catch (NoSuchElementException e) { // XXX - list is empty? } }
/** * Add a new value to the header with the supplied name. * * @param name * the name of the header to add a new value for * @param value * another value */ public void addHeader(String name, String value) { List list = getHeaderList(name); if (list == null) { list = new ArrayList(); headers.put(name.toLowerCase(), list); } list.add(new InternetHeader(name, value)); }
/** * If the new header is a Return-Path we get sure that we add it to the top * Javamail, at least until 1.4.0 does the wrong thing if it loaded a stream with * a return-path in the middle. * * @see javax.mail.internet.InternetHeaders#addHeader(java.lang.String, java.lang.String) */ public void addHeader(String arg0, String arg1) { if (RFC2822Headers.RETURN_PATH.equalsIgnoreCase(arg0)) { headers.add(0, new InternetHeader(arg0, arg1)); } else { super.addHeader(arg0, arg1); } }
/** * Set the value of the header to the supplied value; any existing headers * are removed. * * @param name * the name of the header * @param value * the new value */ public void setHeader(String name, String value) { List list = new ArrayList(); list.add(new InternetHeader(name, value)); setHeaderList(name, list); }
void setHeader(String name, Address[] addresses) { List list = new ArrayList(addresses.length); for (int i = 0; i < addresses.length; i++) { Address address = addresses[i]; list.add(new InternetHeader(name, address.toString())); } headers.put(name.toLowerCase(), list); }
pos = i; } else { headers.add(i + 1, new InternetHeader(name, value)); return; pos = i; headers.add(pos, new InternetHeader(name, value));
headers.add(new InternetHeader("Return-Path", null)); headers.add(new InternetHeader("Received", null)); headers.add(new InternetHeader("Resent-Date", null)); headers.add(new InternetHeader("Resent-From", null)); headers.add(new InternetHeader("Resent-Sender", null)); headers.add(new InternetHeader("Resent-To", null)); headers.add(new InternetHeader("Resent-Cc", null)); headers.add(new InternetHeader("Resent-Bcc", null)); headers.add(new InternetHeader("Resent-Message-Id", null)); headers.add(new InternetHeader("Date", null)); headers.add(new InternetHeader("From", null)); headers.add(new InternetHeader("Sender", null)); headers.add(new InternetHeader("Reply-To", null)); headers.add(new InternetHeader("To", null)); headers.add(new InternetHeader("Cc", null)); headers.add(new InternetHeader("Bcc", null)); headers.add(new InternetHeader("Message-Id", null)); headers.add(new InternetHeader("In-Reply-To", null)); headers.add(new InternetHeader("References", null)); headers.add(new InternetHeader("Subject", null)); headers.add(new InternetHeader("Comments", null)); headers.add(new InternetHeader("Keywords", null)); headers.add(new InternetHeader("Errors-To", null)); headers.add(new InternetHeader("MIME-Version", null)); headers.add(new InternetHeader("Content-Type", null)); headers.add(new InternetHeader("Content-Transfer-Encoding", null)); headers.add(new InternetHeader("Content-MD5", null)); headers.add(new InternetHeader(":", null)); headers.add(new InternetHeader("Content-Length", null));
public InternetHeaders() { headers = new ArrayList<InternetHeader>(40); headers.add(new InternetHeader("Return-Path", null)); headers.add(new InternetHeader("Received", null)); headers.add(new InternetHeader("Resent-Date", null)); headers.add(new InternetHeader("Resent-From", null)); headers.add(new InternetHeader("Resent-Sender", null)); headers.add(new InternetHeader("Resent-To", null)); headers.add(new InternetHeader("Resent-Cc", null)); headers.add(new InternetHeader("Resent-Bcc", null)); headers.add(new InternetHeader("Resent-Message-Id", null)); headers.add(new InternetHeader("Date", null)); headers.add(new InternetHeader("From", null)); headers.add(new InternetHeader("Sender", null)); headers.add(new InternetHeader("Reply-To", null)); headers.add(new InternetHeader("To", null)); headers.add(new InternetHeader("Cc", null)); headers.add(new InternetHeader("Bcc", null)); headers.add(new InternetHeader("Message-Id", null)); headers.add(new InternetHeader("In-Reply-To", null)); headers.add(new InternetHeader("References", null)); headers.add(new InternetHeader("Subject", null)); headers.add(new InternetHeader("Comments", null)); headers.add(new InternetHeader("Keywords", null)); headers.add(new InternetHeader("Errors-To", null)); headers.add(new InternetHeader("MIME-Version", null)); headers.add(new InternetHeader("Content-Type", null)); headers.add(new InternetHeader("Content-Transfer-Encoding", null)); headers.add(new InternetHeader("Content-MD5", null));