/** * 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) { // look for a header match for (int i = 0; i < headers.size(); i++) { InternetHeader header = (InternetHeader)headers.get(i); // found a matching header if (name.equalsIgnoreCase(header.getName())) { // we update both the name and the value for a set so that // the header ends up with the same case as what is getting set header.setValue(value); header.setName(name); // remove all of the headers from this point removeHeaders(name, i + 1); return; } } // doesn't exist, so process as an add. addHeader(name, value); }