/** * 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 */ public String[] getHeader(String name) { @SuppressWarnings("unchecked") Iterator<InternetHeader> e = headers.iterator(); // XXX - should we just step through in index order? List<String> v = new ArrayList<String>(); // accumulate return values while (e.hasNext()) { InternetHeader h = e.next(); if (name.equalsIgnoreCase(h.getName()) && h.line != null) { v.add(h.getValue()); } } if (v.size() == 0) return (null); // convert List to an array for return String r[] = new String[v.size()]; r = v.toArray(r); return (r); }
/** * 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 */ public String[] getHeader(String name) { Iterator<InternetHeader> e = headers.iterator(); // XXX - should we just step through in index order? List<String> v = new ArrayList<>(); // accumulate return values while (e.hasNext()) { InternetHeader h = e.next(); if (name.equalsIgnoreCase(h.getName()) && h.line != null) { v.add(h.getValue()); } } if (v.size() == 0) return (null); // convert List to an array for return String r[] = new String[v.size()]; r = v.toArray(r); return (r); }
public Object nextElement() { if (next_header == null) next_header = nextMatch(); if (next_header == null) throw new NoSuchElementException("No more headers"); InternetHeader h = next_header; next_header = null; if (want_line) return h.line; else return new Header(h.getName(), h.getValue()); }
/** * 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 */ public String[] getHeader(String name) { Iterator e = headers.iterator(); // XXX - should we just step through in index order? List v = new ArrayList(); // accumulate return values while (e.hasNext()) { InternetHeader h = (InternetHeader)e.next(); if (name.equalsIgnoreCase(h.getName()) && h.line != null) { v.add(h.getValue()); } } if (v.size() == 0) return (null); // convert List to an array for return String r[] = new String[v.size()]; r = (String[])v.toArray(r); return (r); }
/** * 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 */ public String[] getHeader(String name) { Iterator<InternetHeader> e = headers.iterator(); // XXX - should we just step through in index order? List<String> v = new ArrayList<>(); // accumulate return values while (e.hasNext()) { InternetHeader h = e.next(); if (name.equalsIgnoreCase(h.getName()) && h.line != null) { v.add(h.getValue()); } } if (v.size() == 0) return (null); // convert List to an array for return String r[] = new String[v.size()]; r = v.toArray(r); return (r); }
/** * 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 */ public String[] getHeader(String name) { Iterator<InternetHeader> e = headers.iterator(); // XXX - should we just step through in index order? List<String> v = new ArrayList<>(); // accumulate return values while (e.hasNext()) { InternetHeader h = e.next(); if (name.equalsIgnoreCase(h.getName()) && h.line != null) { v.add(h.getValue()); } } if (v.size() == 0) return (null); // convert List to an array for return String r[] = new String[v.size()]; r = v.toArray(r); return (r); }
/** * Return all the values for the specified header. * * @param name * the header to return * @return the values for that header, or null if the header is not present */ public String[] getHeader(String name) { List accumulator = new ArrayList(); for (int i = 0; i < headers.size(); i++) { InternetHeader header = (InternetHeader)headers.get(i); if (header.getName().equalsIgnoreCase(name) && header.getValue() != null) { accumulator.add(header.getValue()); } } // this is defined as returning null of nothing is found. if (accumulator.isEmpty()) { return null; } // convert this to an array. return (String[])accumulator.toArray(new String[accumulator.size()]); }
/** * Return all the values for the specified header. * * @param name * the header to return * @return the values for that header, or null if the header is not present */ public String[] getHeader(String name) { List headers = getHeaderList(name); if (headers == null) { return null; } else { String[] result = new String[headers.size()]; for (int i = 0; i < headers.size(); i++) { InternetHeader header = (InternetHeader) headers.get(i); result[i] = header.getValue(); } return result; } }
/** * Return all non matching Header objects. */ public Enumeration getNonMatchingHeaders(String[] names) { List result = new ArrayList(); for (int i = 0; i < headers.size(); i++) { InternetHeader header = (InternetHeader)headers.get(i); // we only include headers with real values, no placeholders if (header.getValue() != null) { // only add the non-matching ones if (!matchHeader(header.getName(), names)) { result.add(header); } } } return Collections.enumeration(result); }
/** * Return all headers. * * @return an Enumeration<Header> containing all headers */ public Enumeration getAllHeaders() { List result = new ArrayList(); for (int i = 0; i < headers.size(); i++) { InternetHeader header = (InternetHeader)headers.get(i); // we only include headers with real values, no placeholders if (header.getValue() != null) { result.add(header); } } // just return a list enumerator for the header list. return Collections.enumeration(result); }
/** * Return all matching Header objects. */ public Enumeration getMatchingHeaders(String[] names) { List result = new ArrayList(); for (int i = 0; i < headers.size(); i++) { InternetHeader header = (InternetHeader)headers.get(i); // we only include headers with real values, no placeholders if (header.getValue() != null) { // only add the matching ones if (matchHeader(header.getName(), names)) { result.add(header); } } } return Collections.enumeration(result); }
public Object nextElement() { if (next_header == null) next_header = nextMatch(); if (next_header == null) throw new NoSuchElementException("No more headers"); InternetHeader h = next_header; next_header = null; if (want_line) return h.line; else return new Header(h.getName(), h.getValue()); }
public Object nextElement() { if (next_header == null) next_header = nextMatch(); if (next_header == null) throw new NoSuchElementException("No more headers"); InternetHeader h = next_header; next_header = null; if (want_line) return h.line; else return new Header(h.getName(), h.getValue()); }
public Object nextElement() { if (next_header == null) next_header = nextMatch(); if (next_header == null) throw new NoSuchElementException("No more headers"); InternetHeader h = next_header; next_header = null; if (want_line) return h.line; else return new Header(h.getName(), h.getValue()); }
public Object nextElement() { if (next_header == null) next_header = nextMatch(); if (next_header == null) throw new NoSuchElementException("No more headers"); InternetHeader h = next_header; next_header = null; if (want_line) return h.line; else return new Header(h.getName(), h.getValue()); }
public Object nextElement() { if (next_header == null) next_header = nextMatch(); if (next_header == null) throw new NoSuchElementException("No more headers"); InternetHeader h = next_header; next_header = null; if (want_line) return h.line; else return new Header(h.getName(), h.getValue()); }
public Object nextElement() { if (next_header == null) next_header = nextMatch(); if (next_header == null) throw new NoSuchElementException("No more headers"); InternetHeader h = next_header; next_header = null; if (want_line) return h.line; else return new Header(h.getName(), h.getValue()); }
public Object nextElement() { if (next_header == null) next_header = nextMatch(); if (next_header == null) throw new NoSuchElementException("No more headers"); InternetHeader h = next_header; next_header = null; if (want_line) return h.line; else return new Header(h.getName(), h.getValue()); }
public Object nextElement() { if (next_header == null) next_header = nextMatch(); if (next_header == null) throw new NoSuchElementException("No more headers"); InternetHeader h = next_header; next_header = null; if (want_line) return h.line; else return new Header(h.getName(), h.getValue()); }
public Object nextElement() { if (next_header == null) next_header = nextMatch(); if (next_header == null) throw new NoSuchElementException("No more headers"); InternetHeader h = next_header; next_header = null; if (want_line) return h.line; else return new Header(h.getName(), h.getValue()); }