Class HttpDateHeader

java.lang.Object
org.apache.juneau.http.header.HttpHeaderBean
org.apache.juneau.http.header.HttpDateHeader
All Implemented Interfaces:
HttpHeader
Direct Known Subclasses:
Date, Expires, IfModifiedSince, IfUnmodifiedSince, LastModified

public class HttpDateHeader extends HttpHeaderBean
Base for HTTP-date headers.
Since:
9.2.1
  • Field Details

  • Constructor Details

    • HttpDateHeader

      protected HttpDateHeader(String name, String value)
      Constructor.
      Parameters:
      name - Header name. Must not be null.
      value - Wire value. Can be null or empty, in which case the parsed value is null.
    • HttpDateHeader

      protected HttpDateHeader(String name, ZonedDateTime value)
      Constructor.
      Parameters:
      name - Header name. Must not be null.
      value - The date value. Can be null, in which case the parsed value is null.
    • HttpDateHeader

      protected HttpDateHeader(String name, Supplier<?> supplier, int lazyMode)
      Constructor with lazy value supplier.
      Parameters:
      name - Header name. Must not be null.
      supplier - The lazy value supplier. Must not be null.
      lazyMode - Either LAZY_WIRE_STRING or LAZY_ZONED_DATE_TIME.
  • Method Details

    • of

      public static HttpDateHeader of(String name, String wireValue)
      Creates an HttpDateHeader by parsing the given RFC-1123 wire-format value.
      Parameters:
      name - Header name. Must not be null.
      wireValue - Wire value (e.g. "Sun, 06 Nov 1994 08:49:37 GMT"). May be null or empty.
      Returns:
      A new instance. Never null.
    • of

      public static HttpDateHeader of(String name, ZonedDateTime typedValue)
      Creates an HttpDateHeader with the given typed value.
      Parameters:
      name - Header name. Must not be null.
      typedValue - The date value. May be null.
      Returns:
      A new instance. Never null.
    • asZonedDateTime

    • getValue

      public String getValue()
      Returns the RFC-1123 wire-format value of this header.
      Specified by:
      getValue in interface HttpHeader
      Overrides:
      getValue in class HttpHeaderBean
      Returns:
      The wire value, or null if the value is unset.
    • orElse

      Returns the parsed value of this header, or the specified default if unset.
      Parameters:
      other - The default value. Can be null to allow a null result when the header is unset.
      Returns:
      The parsed value, or other if the value is unset. Can be null if other is null.
    • toZonedDateTime

      Returns the parsed value of this header.
      Returns:
      The parsed value, or null if the value is unset.