/** * Return all the values for the specified header. The * values are String objects. Returns <code>null</code> * if no headers with the specified name exist. * * @param name header name * @return array of header values, or null if none */ List<String> getHeader(String name) { // XXX - should we just step through in index order? FinalArrayList<String> v = new FinalArrayList<String>(); // accumulate return values int len = headers.size(); for( int i=0; i<len; i++ ) { Hdr h = (Hdr) headers.get(i); if (name.equalsIgnoreCase(h.name)) { v.add(h.getValue()); } } return (v.size() == 0) ? null : v; }
/** * 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. <p> * <p/> * Note that RFC822 headers can only contain US-ASCII characters * * @param line raw RFC822 header line */ void addHeaderLine(String line) { try { char c = line.charAt(0); if (c == ' ' || c == '\t') { hdr h = (hdr) headers.get(headers.size() - 1); h.line += "\r\n" + line; } else headers.add(new hdr(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. <p> * <p/> * Note that RFC822 headers can only contain US-ASCII characters * * @param line raw RFC822 header line */ void addHeaderLine(String line) { try { char c = line.charAt(0); if (c == ' ' || c == '\t') { Hdr h = (Hdr) headers.get(headers.size() - 1); h.line += "\r\n" + line; } else { headers.add(new Hdr(line)); } } catch (StringIndexOutOfBoundsException e) { // line is empty, ignore it } catch (NoSuchElementException e) { // XXX - vector is empty? } }
/** * Return all the values for the specified header. The * values are String objects. Returns <code>null</code> * if no headers with the specified name exist. * * @param name header name * @return array of header values, or null if none */ List<String> getHeader(String name) { // XXX - should we just step through in index order? FinalArrayList<String> v = new FinalArrayList<String>(); // accumulate return values int len = headers.size(); for( int i=0; i<len; i++ ) { Hdr h = (Hdr) headers.get(i); if (name.equalsIgnoreCase(h.name)) { v.add(h.getValue()); } } return (v.size() == 0) ? null : v; }
/** * 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. <p> * <p/> * Note that RFC822 headers can only contain US-ASCII characters * * @param line raw RFC822 header line */ void addHeaderLine(String line) { try { char c = line.charAt(0); if (c == ' ' || c == '\t') { Hdr h = (Hdr) headers.get(headers.size() - 1); h.line += "\r\n" + line; } else { headers.add(new Hdr(line)); } } catch (StringIndexOutOfBoundsException e) { // line is empty, ignore it } catch (NoSuchElementException e) { // XXX - vector is empty? } }
/** * Return all the values for the specified header. The * values are String objects. Returns <code>null</code> * if no headers with the specified name exist. * * @param name header name * @return array of header values, or null if none */ List<String> getHeader(String name) { // XXX - should we just step through in index order? FinalArrayList<String> v = new FinalArrayList<String>(); // accumulate return values int len = headers.size(); for( int i=0; i<len; i++ ) { hdr h = (hdr) headers.get(i); if (name.equalsIgnoreCase(h.name)) { v.add(h.getValue()); } } return (v.size() == 0) ? null : v; }
/** * 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. <p> * <p/> * Note that RFC822 headers can only contain US-ASCII characters * * @param line raw RFC822 header line */ void addHeaderLine(String line) { try { char c = line.charAt(0); if (c == ' ' || c == '\t') { Hdr h = (Hdr) headers.get(headers.size() - 1); h.line += "\r\n" + line; } else { headers.add(new Hdr(line)); } } catch (StringIndexOutOfBoundsException e) { // line is empty, ignore it } catch (NoSuchElementException e) { // XXX - vector is empty? } }
/** * Return all the values for the specified header. The * values are String objects. Returns <code>null</code> * if no headers with the specified name exist. * * @param name header name * @return array of header values, or null if none */ List<String> getHeader(String name) { // XXX - should we just step through in index order? FinalArrayList<String> v = new FinalArrayList<String>(); // accumulate return values int len = headers.size(); for( int i=0; i<len; i++ ) { Hdr h = (Hdr) headers.get(i); if (name.equalsIgnoreCase(h.name)) { v.add(h.getValue()); } } return (v.size() == 0) ? null : v; }