/** * @param name * @param newName * @param value */ public void replace(String name, String newName, String value) { HeaderEntry entry = this.getHeaderEntry(name); if (entry != null) { this.headers.remove(entry); entry.setName(newName); entry.setValue(value, false); this.headers.put(newName.toLowerCase(), entry); } else { entry = new HeaderEntry(name, new String[] {value}); this.headers.put(name.toLowerCase(), entry); } }
/** * @param name * @param value * @param append */ private void setHeader(String name, String value, boolean append) { if (value != null) { HeaderEntry entry = this.getHeaderEntry(name); if (entry != null) { entry.setValue(value, append); } else { entry = new HeaderEntry(name, new String[] {value}); this.headers.put(name.toLowerCase(), entry); } } else { this.remove(name); } }