Class HttpHeaders

java.lang.Object
org.apache.juneau.http.HttpHeaders

public class HttpHeaders extends Object
Standard predefined HTTP headers.
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • accept

      public static final Accept accept(String value)
      Creates a new Accept header.
      Parameters:
      value - The header value.
      Must be parsable by MediaRanges.of(String).
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • accept

      public static final Accept accept(org.apache.juneau.MediaRanges value)
      Creates a new Accept header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • accept

      public static final Accept accept(org.apache.juneau.MediaType value)
      Creates a new Accept header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • accept

      public static final Accept accept(Supplier<org.apache.juneau.MediaRanges> value)
      Creates a new Accept header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • acceptCharset

      public static final AcceptCharset acceptCharset(String value)
      Creates a new AcceptCharset header.
      Parameters:
      value - The header value.
      Must be parsable by StringRanges.of(String).
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • acceptCharset

      public static final AcceptCharset acceptCharset(org.apache.juneau.StringRanges value)
      Creates a new AcceptCharset header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • acceptCharset

      public static final AcceptCharset acceptCharset(Supplier<org.apache.juneau.StringRanges> value)
      Creates a new AcceptCharset header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • acceptEncoding

      public static final AcceptEncoding acceptEncoding(String value)
      Creates a new AcceptEncoding header.
      Parameters:
      value - The header value.
      Must be parsable by StringRanges.of(String).
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • acceptEncoding

      public static final AcceptEncoding acceptEncoding(org.apache.juneau.StringRanges value)
      Creates a new AcceptEncoding header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • acceptEncoding

      public static final AcceptEncoding acceptEncoding(Supplier<org.apache.juneau.StringRanges> value)
      Creates a new AcceptEncoding header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • acceptLanguage

      public static final AcceptLanguage acceptLanguage(String value)
      Creates a new AcceptLanguage header.
      Parameters:
      value - The header value.
      Must be parsable by StringRanges.of(String).
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • acceptLanguage

      public static final AcceptLanguage acceptLanguage(org.apache.juneau.StringRanges value)
      Creates a new AcceptLanguage header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • acceptLanguage

      public static final AcceptLanguage acceptLanguage(Supplier<org.apache.juneau.StringRanges> value)
      Creates a new AcceptLanguage header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • acceptRanges

      public static final AcceptRanges acceptRanges(String value)
      Creates a new AcceptRanges header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • acceptRanges

      public static final AcceptRanges acceptRanges(Supplier<String> value)
      Creates a new AcceptRanges header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • age

      public static final Age age(String value)
      Creates a new Age header.
      Parameters:
      value - The header value.
      Must be parsable using Integer.parseInt(String).
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • age

      public static final Age age(Integer value)
      Creates a new Age header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • age

      public static final Age age(Supplier<Integer> value)
      Creates a new Age header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • allow

      public static final Allow allow(String value)
      Creates a new Allow header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • allow

      public static final Allow allow(String... value)
      Creates a new Allow header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • allow

      public static final Allow allow(Supplier<String[]> value)
      Creates a new Allow header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • authorization

      public static final Authorization authorization(String value)
      Creates a new Authorization header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • authorization

      public static final Authorization authorization(Supplier<String> value)
      Creates a new Authorization header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • cacheControl

      public static final CacheControl cacheControl(String value)
      Creates a new CacheControl header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • cacheControl

      public static final CacheControl cacheControl(Supplier<String> value)
      Creates a new CacheControl header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • clientVersion

      public static final ClientVersion clientVersion(String value)
      Creates a new ClientVersion header.
      Parameters:
      value - The header value.
      Must be parsable by Version.of(String)
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • clientVersion

      public static final ClientVersion clientVersion(org.apache.juneau.Version value)
      Creates a new ClientVersion header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • clientVersion

      public static final ClientVersion clientVersion(Supplier<org.apache.juneau.Version> value)
      Creates a new ClientVersion header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • connection

      public static final Connection connection(String value)
      Creates a new Connection header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • connection

      public static final Connection connection(Supplier<String> value)
      Creates a new Connection header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • contentDisposition

      public static final ContentDisposition contentDisposition(String value)
      Creates a new ContentDisposition header.
      Parameters:
      value - The header value.
      Must be parsable by StringRanges.of(String).
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • contentDisposition

      public static final ContentDisposition contentDisposition(org.apache.juneau.StringRanges value)
      Creates a new ContentDisposition header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • contentDisposition

      public static final ContentDisposition contentDisposition(Supplier<org.apache.juneau.StringRanges> value)
      Creates a new ContentDisposition header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • contentEncoding

      public static final ContentEncoding contentEncoding(String value)
      Creates a new ContentEncoding header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • contentEncoding

      public static final ContentEncoding contentEncoding(Supplier<String> value)
      Creates a new ContentEncoding header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • contentLanguage

      public static final ContentLanguage contentLanguage(String value)
      Creates a new ContentLanguage header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • contentLanguage

      public static final ContentLanguage contentLanguage(String... value)
      Creates a new ContentLanguage header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • contentLanguage

      public static final ContentLanguage contentLanguage(Supplier<String[]> value)
      Creates a new ContentLanguage header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • contentLength

      public static final ContentLength contentLength(String value)
      Creates a new ContentLength header.
      Parameters:
      value - The header value.
      Must be parsable using Long.parseLong(String).
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • contentLength

      public static final ContentLength contentLength(Long value)
      Creates a new ContentLength header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • contentLength

      public static final ContentLength contentLength(Supplier<Long> value)
      Creates a new ContentLength header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • contentLocation

      public static final ContentLocation contentLocation(String value)
      Creates a new ContentLocation header.
      Parameters:
      value - The header value.
      Must be parsable by URI.create(String).
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • contentLocation

      public static final ContentLocation contentLocation(URI value)
      Creates a new ContentLocation header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • contentLocation

      public static final ContentLocation contentLocation(Supplier<URI> value)
      Creates a new ContentLocation header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • contentRange

      public static final ContentRange contentRange(String value)
      Creates a new ContentRange header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • contentRange

      public static final ContentRange contentRange(Supplier<String> value)
      Creates a new ContentRange header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • contentType

      public static final ContentType contentType(String value)
      Creates a new ContentType header.
      Parameters:
      value - The header value.
      Must be parsable by MediaType.of(String).
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • contentType

      public static final ContentType contentType(org.apache.juneau.MediaType value)
      Creates a new ContentType header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • contentType

      public static final ContentType contentType(Supplier<org.apache.juneau.MediaType> value)
      Creates a new ContentType header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • date

      public static final Date date(String value)
      Creates a new Date header.
      Parameters:
      value - The header value.
      Must be an RFC-1123 formated string (e.g. "Sat, 29 Oct 1994 19:43:31 GMT").
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • date

      public static final Date date(ZonedDateTime value)
      Creates a new Date header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • date

      public static final Date date(Supplier<ZonedDateTime> value)
      Creates a new Date header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • debug

      public static final Debug debug(String value)
      Creates a new Debug header.
      Parameters:
      value - The header value.
      Must be parsable by Boolean.parseBoolean(String).
      Can be null.
      Returns:
      A new header bean, or null if the value was null.
    • debug

      public static final Debug debug(Boolean value)
      Creates a new Debug header.
      Parameters:
      value - The header value.
      Must be parsable by Boolean.parseBoolean(String).
      Can be null.
      Returns:
      A new header bean, or null if the value was null.
    • debug

      public static final Debug debug(Supplier<Boolean> value)
      Creates a new Debug header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The header value supplier.
      Can be null.
      Returns:
      A new header bean, or null if the value was null.
    • eTag

      public static final ETag eTag(String value)
      Creates a new ETag header.
      Parameters:
      value - The header value.
      Must be an entity tag value (e.g. "\"xyzzy\"").
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • eTag

      public static final ETag eTag(EntityTag value)
      Creates a new ETag header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • eTag

      public static final ETag eTag(Supplier<EntityTag> value)
      Creates a new ETag header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • expect

      public static final Expect expect(String value)
      Creates a new Expect header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • expect

      public static final Expect expect(Supplier<String> value)
      Creates a new Expect header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • expires

      public static final Expires expires(String value)
      Creates a new Expires header.
      Parameters:
      value - The header value.
      Must be an RFC-1123 formated string (e.g. "Sat, 29 Oct 1994 19:43:31 GMT").
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • expires

      public static final Expires expires(ZonedDateTime value)
      Creates a new Expires header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • expires

      public static final Expires expires(Supplier<ZonedDateTime> value)
      Creates a new Expires header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • forwarded

      public static final Forwarded forwarded(String value)
      Creates a new Forwarded header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • forwarded

      public static final Forwarded forwarded(Supplier<String> value)
      Creates a new Forwarded header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • from

      public static final From from(String value)
      Creates a new From header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • from

      public static final From from(Supplier<String> value)
      Creates a new From header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • host

      public static final Host host(String value)
      Creates a new Host header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • host

      public static final Host host(Supplier<String> value)
      Creates a new Host header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • ifMatch

      public static final IfMatch ifMatch(String value)
      Creates a new IfMatch header.
      Parameters:
      value - The header value.
      Must be a comma-delimited list of entity validator values (e.g. "\"xyzzy\", \"r2d2xxxx\", \"c3piozzzz\"").
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • ifMatch

      public static final IfMatch ifMatch(EntityTags value)
      Creates a new IfMatch header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • ifMatch

      public static final IfMatch ifMatch(Supplier<EntityTags> value)
      Creates a new IfMatch header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • ifModifiedSince

      public static final IfModifiedSince ifModifiedSince(String value)
      Creates a new IfModifiedSince header.
      Parameters:
      value - The header value.
      Must be an RFC-1123 formated string (e.g. "Sat, 29 Oct 1994 19:43:31 GMT").
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • ifModifiedSince

      public static final IfModifiedSince ifModifiedSince(ZonedDateTime value)
      Creates a new IfModifiedSince header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • ifModifiedSince

      public static final IfModifiedSince ifModifiedSince(Supplier<ZonedDateTime> value)
      Creates a new IfModifiedSince header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • ifNoneMatch

      public static final IfNoneMatch ifNoneMatch(String value)
      Creates a new IfNoneMatch header.
      Parameters:
      value - The header value.
      Must be a comma-delimited list of entity validator values (e.g. "\"xyzzy\", \"r2d2xxxx\", \"c3piozzzz\"").
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • ifNoneMatch

      public static final IfNoneMatch ifNoneMatch(EntityTags value)
      Creates a new IfNoneMatch header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • ifNoneMatch

      public static final IfNoneMatch ifNoneMatch(Supplier<EntityTags> value)
      Creates a new IfNoneMatch header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • ifRange

      public static final IfRange ifRange(String value)
      Creates a new IfRange header.
      Parameters:
      value - The header value.
      Must be an RFC-1123 formated string (e.g. "Sat, 29 Oct 1994 19:43:31 GMT").
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • ifRange

      public static final IfRange ifRange(ZonedDateTime value)
      Creates a new IfRange header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • ifRange

      public static final IfRange ifRange(EntityTag value)
      Creates a new IfRange header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • ifRange

      public static final IfRange ifRange(Supplier<?> value)
      Creates a new IfRange header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Supplier must supply either EntityTag or ZonedDateTime objects.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • ifUnmodifiedSince

      public static final IfUnmodifiedSince ifUnmodifiedSince(String value)
      Creates a new IfUnmodifiedSince header.
      Parameters:
      value - The header value.
      Must be an RFC-1123 formated string (e.g. "Sat, 29 Oct 1994 19:43:31 GMT").
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • ifUnmodifiedSince

      public static final IfUnmodifiedSince ifUnmodifiedSince(ZonedDateTime value)
      Creates a new IfUnmodifiedSince header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • ifUnmodifiedSince

      Creates a new IfUnmodifiedSince header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • lastModified

      public static final LastModified lastModified(String value)
      Creates a new LastModified header.
      Parameters:
      value - The header value.
      Must be an RFC-1123 formated string (e.g. "Sat, 29 Oct 1994 19:43:31 GMT").
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • lastModified

      public static final LastModified lastModified(ZonedDateTime value)
      Creates a new LastModified header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • lastModified

      public static final LastModified lastModified(Supplier<ZonedDateTime> value)
      Creates a new LastModified header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • location

      public static final Location location(String value)
      Creates a new Location header.
      Parameters:
      value - The header value.
      Must be parsable by URI.create(String).
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • location

      public static final Location location(URI value)
      Creates a new Location header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • location

      public static final Location location(Supplier<URI> value)
      Creates a new Location header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • maxForwards

      public static final MaxForwards maxForwards(String value)
      Creates a new MaxForwards header.
      Parameters:
      value - The header value.
      Must be parsable using Integer.parseInt(String).
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • maxForwards

      public static final MaxForwards maxForwards(Integer value)
      Creates a new MaxForwards header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • maxForwards

      public static final MaxForwards maxForwards(Supplier<Integer> value)
      Creates a new MaxForwards header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • noTrace

      public static final NoTrace noTrace(String value)
      Creates a new NoTrace header.
      Parameters:
      value - The header value.
      Must be parsable by Boolean.parseBoolean(String).
      Can be null.
      Returns:
      A new header bean, or null if the value was null.
    • noTrace

      public static final NoTrace noTrace(Boolean value)
      Creates a new NoTrace header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value was null.
    • noTrace

      public static final NoTrace noTrace(Supplier<Boolean> value)
      Creates a new NoTrace header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The header value supplier.
      Can be null.
      Returns:
      A new header bean, or null if the value was null.
    • origin

      public static final Origin origin(String value)
      Creates a new Origin header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • origin

      public static final Origin origin(Supplier<String> value)
      Creates a new Origin header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • pragma

      public static final Pragma pragma(String value)
      Creates a new Pragma header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • pragma

      public static final Pragma pragma(Supplier<String> value)
      Creates a new Pragma header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • proxyAuthenticate

      public static final ProxyAuthenticate proxyAuthenticate(String value)
      Creates a new ProxyAuthenticate header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • proxyAuthenticate

      public static final ProxyAuthenticate proxyAuthenticate(Supplier<String> value)
      Creates a new ProxyAuthenticate header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • proxyAuthorization

      public static final ProxyAuthorization proxyAuthorization(String value)
      Creates a new ProxyAuthorization header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • proxyAuthorization

      public static final ProxyAuthorization proxyAuthorization(Supplier<String> value)
      Creates a new ProxyAuthorization header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • range

      public static final Range range(String value)
      Creates a new Range header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • range

      public static final Range range(Supplier<String> value)
      Creates a new Range header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • referer

      public static final Referer referer(String value)
      Creates a new Referer header.
      Parameters:
      value - The header value.
      Must be parsable by URI.create(String).
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • referer

      public static final Referer referer(URI value)
      Creates a new Referer header.
      Parameters:
      value - The header value.
      Must be parsable by URI.create(String).
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • referer

      public static final Referer referer(Supplier<URI> value)
      Creates a new Referer header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • retryAfter

      public static final RetryAfter retryAfter(String value)
      Creates a new RetryAfter header.
      Parameters:
      value - The header value.
      Must be an RFC-1123 formated string (e.g. "Sat, 29 Oct 1994 19:43:31 GMT") or an integer.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • retryAfter

      public static final RetryAfter retryAfter(ZonedDateTime value)
      Creates a new RetryAfter header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • retryAfter

      public static final RetryAfter retryAfter(Integer value)
      Creates a new RetryAfter header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • retryAfter

      public static final RetryAfter retryAfter(Supplier<?> value)
      Creates a new RetryAfter header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Supplier must supply either Integer or ZonedDateTime objects.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • server

      public static final Server server(String value)
      Creates a new Server header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • server

      public static final Server server(Supplier<String> value)
      Creates a new Server header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • te

      public static final TE te(String value)
      Creates a new TE header.
      Parameters:
      value - The header value.
      Must be parsable by StringRanges.of(String).
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • te

      public static final TE te(org.apache.juneau.StringRanges value)
      Creates a new TE header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • te

      public static final TE te(Supplier<org.apache.juneau.StringRanges> value)
      Creates a new TE header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • thrown

      public static final Thrown thrown(String value)
      Creates a new Thrown header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • thrown

      public static final Thrown thrown(Throwable... value)
      Creates a new Thrown header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • trailer

      public static final Trailer trailer(String value)
      Creates a new Trailer header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • trailer

      public static final Trailer trailer(Supplier<String> value)
      Creates a new Trailer header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • transferEncoding

      public static final TransferEncoding transferEncoding(String value)
      Creates a new TransferEncoding header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • transferEncoding

      public static final TransferEncoding transferEncoding(Supplier<String> value)
      Creates a new TransferEncoding header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • upgrade

      public static final Upgrade upgrade(String value)
      Creates a new Upgrade header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • upgrade

      public static final Upgrade upgrade(String... value)
      Creates a new Upgrade header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • upgrade

      public static final Upgrade upgrade(Supplier<String[]> value)
      Creates a new Upgrade header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • userAgent

      public static final UserAgent userAgent(String value)
      Creates a new UserAgent header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • userAgent

      public static final UserAgent userAgent(Supplier<String> value)
      Creates a new UserAgent header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • vary

      public static final Vary vary(String value)
      Creates a new Vary header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • vary

      public static final Vary vary(Supplier<String> value)
      Creates a new Vary header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • via

      public static final Via via(String value)
      Creates a new Via header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • via

      public static final Via via(String... value)
      Creates a new Via header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • via

      public static final Via via(Supplier<String[]> value)
      Creates a new Via header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • warning

      public static final Warning warning(String value)
      Creates a new Warning header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • warning

      public static final Warning warning(Supplier<String> value)
      Creates a new Warning header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • wwwAuthenticate

      public static final WwwAuthenticate wwwAuthenticate(String value)
      Creates a new WwwAuthenticate header.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • wwwAuthenticate

      public static final WwwAuthenticate wwwAuthenticate(Supplier<String> value)
      Creates a new WwwAuthenticate header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • booleanHeader

      public static final BasicBooleanHeader booleanHeader(String name, String value)
      Creates a new BasicBooleanHeader header.
      Parameters:
      name - The header name.
      value - The header value.
      Must be parsable by Boolean.parseBoolean(String).
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • booleanHeader

      public static final BasicBooleanHeader booleanHeader(String name, Boolean value)
      Creates a new BasicBooleanHeader header.
      Parameters:
      name - The header name.
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • booleanHeader

      public static final BasicBooleanHeader booleanHeader(String name, Supplier<Boolean> value)
      Creates a new BasicBooleanHeader header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      name - The header name.
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • csvHeader

      public static final BasicCsvHeader csvHeader(String name, String value)
      Creates a new BasicCsvHeader header.
      Parameters:
      name - The header name.
      value - The header value.
      Must be a comma-delimited list.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • csvHeader

      public static final BasicCsvHeader csvHeader(String name, String... value)
      Creates a new BasicCsvHeader header.
      Parameters:
      name - The header name.
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • csvHeader

      public static final BasicCsvHeader csvHeader(String name, Supplier<String[]> value)
      Creates a new BasicCsvHeader header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      name - The header name.
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • dateHeader

      public static final BasicDateHeader dateHeader(String name, String value)
      Creates a new BasicDateHeader header.
      Parameters:
      name - The header name.
      value - The header value.
      Must be an RFC-1123 formated string (e.g. "Sat, 29 Oct 1994 19:43:31 GMT").
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • dateHeader

      public static final BasicDateHeader dateHeader(String name, ZonedDateTime value)
      Creates a new BasicDateHeader header.
      Parameters:
      name - The header name.
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • dateHeader

      public static final BasicDateHeader dateHeader(String name, Supplier<ZonedDateTime> value)
      Creates a new BasicDateHeader header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      name - The header name.
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • entityTagsHeader

      public static final BasicEntityTagsHeader entityTagsHeader(String name, String value)
      Creates a new BasicEntityTagsHeader header.
      Parameters:
      name - The header name.
      value - The header value.
      Must be a comma-delimited list of entity validator values (e.g. "\"xyzzy\", \"r2d2xxxx\", \"c3piozzzz\"").
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • entityTagsHeader

      public static final BasicEntityTagsHeader entityTagsHeader(String name, EntityTags value)
      Creates a new BasicEntityTagsHeader header.
      Parameters:
      name - The header name.
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • entityTagsHeader

      public static final BasicEntityTagsHeader entityTagsHeader(String name, Supplier<EntityTags> value)
      Creates a new BasicEntityTagsHeader header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      name - The header name.
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • entityTagHeader

      public static final BasicEntityTagHeader entityTagHeader(String name, String value)
      Creates a new BasicEntityTagHeader header.
      Parameters:
      name - The header name.
      value - The header value.
      Must be an entity tag value (e.g. "\"xyzzy\"").
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • entityTagHeader

      public static final BasicEntityTagHeader entityTagHeader(String name, EntityTag value)
      Creates a new BasicEntityTagHeader header.
      Parameters:
      name - The header name.
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • entityTagHeader

      public static final BasicEntityTagHeader entityTagHeader(String name, Supplier<EntityTag> value)
      Creates a new BasicEntityTagHeader header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      name - The header name.
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • integerHeader

      public static final BasicIntegerHeader integerHeader(String name, String value)
      Creates a new BasicIntegerHeader header.
      Parameters:
      name - The header name.
      value - The header value.
      Must be parsable using Integer.parseInt(String).
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • integerHeader

      public static final BasicIntegerHeader integerHeader(String name, Integer value)
      Creates a new BasicIntegerHeader header.
      Parameters:
      name - The header name.
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • integerHeader

      public static final BasicIntegerHeader integerHeader(String name, Supplier<Integer> value)
      Creates a new BasicIntegerHeader header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      name - The header name.
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • longHeader

      public static final BasicLongHeader longHeader(String name, String value)
      Creates a new BasicLongHeader header.
      Parameters:
      name - The header name.
      value - The header value.
      Must be parsable by Long.parseLong(String).
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • longHeader

      public static final BasicLongHeader longHeader(String name, Long value)
      Creates a new BasicLongHeader header.
      Parameters:
      name - The header name.
      value - The header value.
      Must be parsable by Long.parseLong(String).
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • longHeader

      public static final BasicLongHeader longHeader(String name, Supplier<Long> value)
      Creates a new BasicLongHeader header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      name - The header name.
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • mediaRangesHeader

      public static final BasicMediaRangesHeader mediaRangesHeader(String name, String value)
      Creates a new BasicMediaRangesHeader header.
      Parameters:
      name - The header name.
      value - The header value.
      Must be parsable by MediaRanges.of(String).
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • mediaRangesHeader

      public static final BasicMediaRangesHeader mediaRangesHeader(String name, org.apache.juneau.MediaRanges value)
      Creates a new BasicMediaRangesHeader header.
      Parameters:
      name - The header name.
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • mediaRangesHeader

      public static final BasicMediaRangesHeader mediaRangesHeader(String name, Supplier<org.apache.juneau.MediaRanges> value)
      Creates a new BasicMediaRangesHeader header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      name - The header name.
      value - The header value.
      Must be parsable by MediaRanges.of(String).
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • mediaTypeHeader

      public static final BasicMediaTypeHeader mediaTypeHeader(String name, String value)
      Creates a new BasicMediaTypeHeader header.
      Parameters:
      name - The header name.
      value - The header value.
      Must be parsable by MediaType.of(String).
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • mediaTypeHeader

      public static final BasicMediaTypeHeader mediaTypeHeader(String name, org.apache.juneau.MediaType value)
      Creates a new BasicMediaTypeHeader header.
      Parameters:
      name - The header name.
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • mediaTypeHeader

      public static final BasicMediaTypeHeader mediaTypeHeader(String name, Supplier<org.apache.juneau.MediaType> value)
      Creates a new BasicMediaTypeHeader header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      name - The header name.
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • stringHeader

      public static final BasicStringHeader stringHeader(String pair)
      Creates a BasicHeader from a name/value pair string (e.g. "Foo: bar")
      Parameters:
      pair - The pair string.
      Returns:
      A new header bean, or null if the value was null.
    • basicHeader

      public static final BasicHeader basicHeader(String name, Object value)
      Creates a new BasicHeader header.
      Parameters:
      name - The parameter name.
      value - The parameter value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • basicHeader

      public static final BasicHeader basicHeader(String name, Supplier<?> value)
      Creates a new BasicHeader header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      name - The header name.
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • serializedHeader

      public static final SerializedHeader serializedHeader(String name, Object value)
      Creates a new SerializedHeader header.
      Parameters:
      name - The header name.
      value - The POJO to serialize as the header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty.
    • serializedHeader

      public static SerializedHeader serializedHeader(String name, Object value, org.apache.juneau.httppart.HttpPartSerializerSession serializer, org.apache.juneau.httppart.HttpPartSchema schema, boolean skipIfEmpty)
      Creates a new SerializedHeader header.
      Parameters:
      name - The HTTP header name name.
      value - The POJO to serialize as the header value.
      serializer - The serializer to use for serializing the value to a string value.
      schema - The schema object that defines the format of the output.
      If null, defaults to the schema defined on the serializer.
      If that's also null, defaults to HttpPartSchema.DEFAULT.
      Only used if serializer is schema-aware (e.g. OpenApiSerializer).
      Can also be a Supplier.
      skipIfEmpty - If value is a blank string, the value should return as null.
      Returns:
      A new header bean, or null if the name is null or empty.
    • serializedHeader

      public static SerializedHeader serializedHeader(String name, Supplier<?> value, org.apache.juneau.httppart.HttpPartSerializerSession serializer, org.apache.juneau.httppart.HttpPartSchema schema, boolean skipIfEmpty)
      Creates a new SerializedHeader header.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      name - The HTTP header name name.
      value - The supplier of the POJO to serialize as the header value.
      serializer - The serializer to use for serializing the value to a string value.
      schema - The schema object that defines the format of the output.
      If null, defaults to the schema defined on the serializer.
      If that's also null, defaults to HttpPartSchema.DEFAULT.
      Only used if serializer is schema-aware (e.g. OpenApiSerializer).
      Can also be a Supplier.
      skipIfEmpty - If value is a blank string, the value should return as null.
      Returns:
      A new header bean, or null if the name is null or empty.
    • serializedHeader

      public static final SerializedHeader serializedHeader(String name, Supplier<?> value)
      Creates a new SerializedHeader header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      name - The header name.
      value - The supplier of the POJO to serialize as the header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty.
    • stringHeader

      public static final BasicStringHeader stringHeader(String name, String value)
      Creates a new BasicStringHeader header.
      Parameters:
      name - The header name.
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • stringHeader

      public static final BasicStringHeader stringHeader(String name, Supplier<String> value)
      Creates a new BasicStringHeader header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      name - The header name.
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • stringRangesHeader

      public static final BasicStringRangesHeader stringRangesHeader(String name, String value)
      Creates a new BasicStringRangesHeader header.
      Parameters:
      name - The header name.
      value - The header value.
      Must be parsable by StringRanges.of(String).
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • stringRangesHeader

      public static final BasicStringRangesHeader stringRangesHeader(String name, org.apache.juneau.StringRanges value)
      Creates a new BasicStringRangesHeader header.
      Parameters:
      name - The header name.
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • stringRangesHeader

      public static final BasicStringRangesHeader stringRangesHeader(String name, Supplier<org.apache.juneau.StringRanges> value)
      Creates a new BasicStringRangesHeader header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      name - The header name.
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • uriHeader

      public static final BasicUriHeader uriHeader(String name, String value)
      Creates a new BasicUriHeader header.
      Parameters:
      name - The header name.
      value - The header value.
      Must be parsable by URI.create(String).
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • uriHeader

      public static final BasicUriHeader uriHeader(String name, URI value)
      Creates a new BasicUriHeader header.
      Parameters:
      name - The header name.
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • uriHeader

      public static final BasicUriHeader uriHeader(String name, Supplier<URI> value)
      Creates a new BasicUriHeader header with a delayed value.

      Header value is re-evaluated on each call to NameValuePair.getValue().

      Parameters:
      name - The header name.
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the name is null or empty or the value is null.
    • header

      public static final <T extends Header> T header(Class<T> type, String name, Object value)
      Creates a new Header of the specified type.

      The implementation class must have a public constructor taking in one of the following argument lists:

      • public X(String headerValue)
      • public X(Object headerValue)
      • public X(String headerName, String headerValue)
      • public X(String headerName, Object headerValue)
      Type Parameters:
      T - The header implementation class.
      Parameters:
      type - The header implementation class.
      name - The header name.
      value - The header value.
      Returns:
      A new unmodifiable instance, never null.
    • header

      public static final <T extends Header> T header(Class<T> type, Object value)
      Creates a new Header of the specified type.

      Same as header(Class, String, Object) but the header name is pulled from the @Header(name) or @Header(value) annotations.

      Type Parameters:
      T - The header implementation class.
      Parameters:
      type - The header implementation class.
      value - The header value.
      Returns:
      A new unmodifiable instance, never null.
    • headerList

      public static final HeaderList headerList()
      Instantiates a new HeaderList.
      Returns:
      A new empty builder.
    • headerList

      public static final HeaderList headerList(List<Header> headers)
      Creates a new HeaderList initialized with the specified headers.
      Parameters:
      headers - The headers to add to the list. Can be null. null entries are ignored.
      Returns:
      A new unmodifiable instance, never null.
    • headerList

      public static final HeaderList headerList(Header... headers)
      Creates a new HeaderList initialized with the specified headers.
      Parameters:
      headers - The headers to add to the list. null entries are ignored.
      Returns:
      A new unmodifiable instance, never null.
    • headerList

      public static HeaderList headerList(String... pairs)
      Creates a new HeaderList initialized with the specified name/value pairs.
      Parameters:
      pairs - Initial list of pairs.
      Must be an even number of parameters representing key/value pairs.
      Returns:
      A new instance.
      Throws:
      RuntimeException - If odd number of parameters were specified.
    • canCast

      public static boolean canCast(Object o)
      Returns true if the cast(Object) method can be used on the specified object.
      Parameters:
      o - The object to check.
      Returns:
      true if the cast(Object) method can be used on the specified object.
    • cast

      public static Header cast(Object o)
      Utility method for converting an arbitrary object to a Header.
      Parameters:
      o - The object to cast or convert to a Header.
      Returns:
      Either the same object cast as a Header or converted to a Header.