001// *************************************************************************************************************************** 002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * 003// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * 004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * 005// * with the License. You may obtain a copy of the License at * 006// * * 007// * http://www.apache.org/licenses/LICENSE-2.0 * 008// * * 009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * 010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * 011// * specific language governing permissions and limitations under the License. * 012// *************************************************************************************************************************** 013package org.apache.juneau.http; 014 015import org.apache.juneau.http.annotation.*; 016 017/** 018 * Represents a parsed <l>Expires</l> HTTP response header. 019 * 020 * <p> 021 * Gives the date/time after which the response is considered stale (in "HTTP-date" format as defined by RFC 7231). 022 * 023 * <h5 class='figure'>Example</h5> 024 * <p class='bcode w800'> 025 * Expires: Thu, 01 Dec 1994 16:00:00 GMT 026 * </p> 027 * 028 * <h5 class='topic'>RFC2616 Specification</h5> 029 * 030 * The Expires entity-header field gives the date/time after which the response is considered stale. 031 * A stale cache entry may not normally be returned by a cache (either a proxy cache or a user agent cache) unless it is 032 * first validated with the origin server 033 * (or with an intermediate cache that has a fresh copy of the entity). 034 * See section 13.2 for further discussion of the expiration model. 035 * 036 * <p> 037 * The presence of an Expires field does not imply that the original resource will change or cease to exist at, before, 038 * or after that time. 039 * 040 * <p> 041 * 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: 042 * 043 * <p class='bcode w800'> 044 * Expires = "Expires" ":" HTTP-date 045 * </p> 046 * 047 * <p> 048 * An example of its use is... 049 * <p class='bcode w800'> 050 * Expires: Thu, 01 Dec 1994 16:00:00 GMT 051 * </p> 052 * 053 * <p> 054 * Note: if a response includes a Cache-Control field with the max-age directive (see section 14.9.3), that directive 055 * overrides the Expires field. 056 * 057 * <p> 058 * HTTP/1.1 clients and caches MUST treat other invalid date formats, especially including the value "0", as in the past 059 * (i.e., "already expired"). 060 * 061 * <p> 062 * To mark a response as "already expired," an origin server sends an Expires date that is equal to the Date header 063 * value. 064 * (See the rules for expiration calculations in section 13.2.4.) 065 * 066 * <p> 067 * To mark a response as "never expires," an origin server sends an Expires date approximately one year from the time 068 * the response is sent. 069 * HTTP/1.1 servers SHOULD NOT send Expires dates more than one year in the future. 070 * 071 * <p> 072 * The presence of an Expires header field with a date value of some time in the future on a response that otherwise 073 * would by default be non-cacheable indicates that the response is cacheable, unless indicated otherwise by a 074 * Cache-Control header field (section 14.9). 075 * 076 * <ul class='seealso'> 077 * <li class='extlink'>{@doc RFC2616} 078 * </ul> 079 */ 080@Header("Expires") 081public final class Expires extends HeaderDate { 082 083 /** 084 * Returns a parsed <c>Expires</c> header. 085 * 086 * @param value The <c>Expires</c> header string. 087 * @return The parsed <c>Expires</c> header, or <jk>null</jk> if the string was null. 088 */ 089 public static Expires forString(String value) { 090 if (value == null) 091 return null; 092 return new Expires(value); 093 } 094 095 private Expires(String value) { 096 super(value); 097 } 098}