Class Expires

All Implemented Interfaces:
Serializable, Cloneable, Header, NameValuePair

@Header("Expires") public class Expires extends BasicDateHeader
Represents a parsed Expires HTTP response header.

Gives the date/time after which the response is considered stale (in "HTTP-date" format as defined by RFC 7231).

Example

Expires: Thu, 01 Dec 1994 16:00:00 GMT

RFC2616 Specification
The Expires entity-header field gives the date/time after which the response is considered stale. A stale cache entry may not normally be returned by a cache (either a proxy cache or a user agent cache) unless it is first validated with the origin server (or with an intermediate cache that has a fresh copy of the entity). See section 13.2 for further discussion of the expiration model.

The presence of an Expires field does not imply that the original resource will change or cease to exist at, before, or after that time.

The format is an absolute date and time as defined by HTTP-date in section 3.3.1; it MUST be in RFC 1123 date format:

Expires = "Expires" ":" HTTP-date

An example of its use is...

Expires: Thu, 01 Dec 1994 16:00:00 GMT

Note: if a response includes a Cache-Control field with the max-age directive (see section 14.9.3), that directive overrides the Expires field.

HTTP/1.1 clients and caches MUST treat other invalid date formats, especially including the value "0", as in the past (i.e., "already expired").

To mark a response as "already expired," an origin server sends an Expires date that is equal to the Date header value. (See the rules for expiration calculations in section 13.2.4.)

To mark a response as "never expires," an origin server sends an Expires date approximately one year from the time the response is sent. HTTP/1.1 servers SHOULD NOT send Expires dates more than one year in the future.

The presence of an Expires header field with a date value of some time in the future on a response that otherwise would by default be non-cacheable indicates that the response is cacheable, unless indicated otherwise by a Cache-Control header field (section 14.9).

See Also:
  • Constructor Details

    • Expires

      public Expires(String value)
      Constructor.
      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.
    • Expires

      public Expires(ZonedDateTime value)
      Constructor.
      Parameters:
      value - The header value.
      Can be null.
    • Expires

      public Expires(Supplier<ZonedDateTime> value)
      Constructor with delayed value.

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

      Parameters:
      value - The supplier of the header value.
      Can be null.
  • Method Details

    • of

      public static Expires of(String value)
      Static creator.
      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.
    • of

      public static Expires of(ZonedDateTime value)
      Static creator.
      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.
    • of

      public static Expires of(Supplier<ZonedDateTime> value)
      Static creator with delayed value.

      Header value is re-evaluated on each call to BasicDateHeader.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.