/** * Sets the (only) value for the header with the specified name. * <p/> * All existing values for the same header will be removed. * * @param name The name of the header * @param value The value of the header * @return {@code this} */ public SELF header(CharSequence name, Instant value) { checkNotCookie(name); headers.set(name, checkNotNull(value)); return (SELF) this; }
/** * Adds a new header with the specified {@code name} and {@code value}. * <p/> * Will not replace any existing values for the header. * * @param name The name of the header * @param values The value of the header * @return {@code this} */ public SELF addHeader(CharSequence name, Iterable<?> values) { checkNotCookie(name); headers.add(name, values); return (SELF) this; }
/** * Sets the (only) value for the header with the specified name. * <p/> * All existing values for the same header will be removed. * * @param name The name of the header * @param values The value of the header * @return {@code this} */ public SELF header(CharSequence name, Iterable<?> values) { checkNotCookie(name); headers.set(name, values); return (SELF) this; }
/** * Adds a new header with the specified {@code name} and {@code value}. * <p/> * Will not replace any existing values for the header. * * @param name The name of the header * @param value The value of the header * @return {@code this} */ public SELF addHeader(CharSequence name, String value) { checkNotCookie(name); headers.add(name, value); return (SELF) this; }
/** * Sets the (only) value for the header with the specified name. * <p/> * All existing values for the same header will be removed. * * @param name The name of the header * @param value The value of the header * @return {@code this} */ public SELF header(CharSequence name, String value) { checkNotCookie(name); headers.set(name, checkNotNull(value)); return (SELF) this; }
/** * Sets the (only) value for the header with the specified name. * <p/> * All existing values for the same header will be removed. * * @param name The name of the header * @param value The value of the header * @return {@code this} */ public SELF header(CharSequence name, Object value) { checkNotCookie(name); headers.set(name, checkNotNull(value)); return (SELF) this; }
/** * Adds a new header with the specified {@code name} and {@code value}. * <p/> * Will not replace any existing values for the header. * * @param name The name of the header * @param value The value of the header * @return {@code this} */ public SELF addHeader(CharSequence name, Object value) { checkNotCookie(name); headers.add(name, value); return (SELF) this; }
public SELF headers(HttpHeader... headers) { for (HttpHeader header : headers) { checkNotCookie(header.name()); this.headers.set(header.name(), header.value()); } return (SELF) this; }