Class HttpStringHeader

java.lang.Object
org.apache.juneau.http.header.HttpHeaderBean
org.apache.juneau.http.header.HttpStringHeader
All Implemented Interfaces:
HttpHeader
Direct Known Subclasses:
AcceptRanges, Authorization, CacheControl, ClientVersion, Connection, ContentEncoding, ContentRange, ContentSecurityPolicy, Expect, Forwarded, From, Host, Origin, Pragma, ProxyAuthenticate, ProxyAuthorization, Range, Server, Trailer, TransferEncoding, UserAgent, Warning, WwwAuthenticate

public class HttpStringHeader extends HttpHeaderBean
Base type for HTTP headers whose value is an opaque string (or lazy Supplier of string).
See Also:
Since:
9.2.1
  • Constructor Details

    • HttpStringHeader

      protected HttpStringHeader(String name, String value)
      Parameters:
      name - Header name. Must not be null.
      value - Wire value. May be null.
    • HttpStringHeader

      protected HttpStringHeader(String name, Supplier<String> valueSupplier)
      Parameters:
      name - Header name. Must not be null.
      valueSupplier - Lazy wire value supplier. Must not be null.
  • Method Details

    • of

      public static HttpStringHeader of(String name, String value)
      Creates an HttpStringHeader with the given name and value.
      Parameters:
      name - Header name. Must not be null.
      value - Wire value. May be null.
      Returns:
      A new instance. Never null.
    • of

      public static HttpStringHeader of(String name, Supplier<String> valueSupplier)
      Creates an HttpStringHeader with the given name and lazy value supplier.
      Parameters:
      name - Header name. Must not be null.
      valueSupplier - Lazy wire value supplier. Must not be null.
      Returns:
      A new instance. Never null.
    • ofPair

      public static HttpStringHeader ofPair(String pair)
      Parses a header line of the form "Name: value" (or "Name=value") into an HttpStringHeader.

      If the input does not contain ':' or '=', the entire string is treated as a header name with an empty value.

      Parameters:
      pair - The header pair. May be null.
      Returns:
      A new instance, or null if pair is null.