/** * 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; }
/** * 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; }
/** * 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 Builder header(CharSequence name, Object value) { checkNotCookie(name); this.headers.set(name, value); return 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} */ @Override public Builder header(CharSequence name, Object value) { this.headers.set(name, value); return 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; }
/** * 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 Builder header(CharSequence name, Object value) { checkNotCookie(name); this.headers.set(name, value); return 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 Builder header(CharSequence name, Object value) { this.headers.set(name, value); return 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 Builder header(CharSequence name, Object value) { this.headers.set(name, value); return 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 Builder header(CharSequence name, Object value) { this.headers.set(name, value); return 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 Builder header(CharSequence name, Object value) { this.headers.set(name, value); return 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 Builder header(CharSequence name, Object value) { this.headers.set(name, value); return this; }
@Test public void setsDateHeaders() { Instant time = ZonedDateTime.of(2015, 9, 10, 12, 2, 28, 0, UTC).toInstant(); HttpHeaders headers = new HttpHeaders.Builder() .set("foo", time) .build(); assertThat(headers.get("foo"), isValue("Thu, 10 Sep 2015 12:02:28 GMT")); } }
public SELF headers(HttpHeader... headers) { for (HttpHeader header : headers) { checkNotCookie(header.name()); this.headers.set(header.name(), header.value()); } return (SELF) this; }