/** * Remove all header entries that match the given name * @param name header name */ public void removeHeader(String name) { for (int i = 0; i < headers.size(); i++) { InternetHeader h = headers.get(i); if (name.equalsIgnoreCase(h.getName())) { h.line = null; //headers.remove(i); //i--; // have to look at i again } } }
/** * Remove all header entries that match the given name * @param name header name */ public void removeHeader(String name) { for (int i = 0; i < headers.size(); i++) { InternetHeader h = (InternetHeader)headers.get(i); if (name.equalsIgnoreCase(h.getName())) { h.line = null; //headers.remove(i); //i--; // have to look at i again } } }
/** * 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); }
/** * Remove all header entries that match the given name * @param name header name */ public void removeHeader(String name) { for (int i = 0; i < headers.size(); i++) { InternetHeader h = headers.get(i); if (name.equalsIgnoreCase(h.getName())) { h.line = null; //headers.remove(i); //i--; // have to look at i again } } }
public int hashCode() { return getName().toLowerCase().hashCode(); } }
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()); }
private InternetHeader nextMatch() { next: while (e.hasNext()) { InternetHeader h = e.next(); // skip "place holder" headers if (h.line == null) continue; // if no names to match against, return appropriately if (names == null) return match ? null : h; // check whether this header matches any of the names for (int i = 0; i < names.length; i++) { if (names[i].equalsIgnoreCase(h.getName())) { if (match) return h; else // found a match, but we're // looking for non-matches. // try next header. continue next; } } // found no matches. if that's what we wanted, return it. if (!match) return h; } return null; } }
if (name.equalsIgnoreCase(h.getName())) { if (!found) { int j;
private InternetHeader nextMatch() { next: while (e.hasNext()) { InternetHeader h = e.next(); // skip "place holder" headers if (h.line == null) continue; // if no names to match against, return appropriately if (names == null) return match ? null : h; // check whether this header matches any of the names for (int i = 0; i < names.length; i++) { if (names[i].equalsIgnoreCase(h.getName())) { if (match) return h; else // found a match, but we're // looking for non-matches. // try next header. continue next; } } // found no matches. if that's what we wanted, return it. if (!match) return h; } return null; } }
if (name.equalsIgnoreCase(h.getName())) { if (!found) { int j;
/** * 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); }
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()); }