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>If-Unmodified-Since</l> HTTP request header.
019 *
020 * <p>
021 * Only send the response if the entity has not been modified since a specific time.
022 *
023 * <h5 class='figure'>Example</h5>
024 * <p class='bcode w800'>
025 *    If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT
026 * </p>
027 *
028 * <h5 class='topic'>RFC2616 Specification</h5>
029 *
030 * The If-Unmodified-Since request-header field is used with a method to make it conditional.
031 * If the requested resource has not been modified since the time specified in this field, the server SHOULD perform the
032 * requested operation as if the If-Unmodified-Since header were not present.
033 *
034 * <p>
035 * If the requested variant has been modified since the specified time, the server MUST NOT perform the requested
036 * operation, and MUST return a 412 (Precondition Failed).
037 *
038 * <p class='bcode w800'>
039 *    If-Unmodified-Since = "If-Unmodified-Since" ":" HTTP-date
040 * </p>
041 *
042 * <p>
043 * An example of the field is:
044 * <p class='bcode w800'>
045 *    If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT
046 * </p>
047 *
048 * <p>
049 * If the request normally (i.e., without the If-Unmodified-Since header) would result in anything other than a 2xx or
050 * 412 status, the If-Unmodified-Since header SHOULD be ignored.
051 *
052 * <p>
053 * If the specified date is invalid, the header is ignored.
054 *
055 * <p>
056 * The result of a request having both an If-Unmodified-Since header field and either an If-None-Match or an
057 * If-Modified-Since header fields is undefined by this specification.
058 *
059 * <h5 class='section'>See Also:</h5>
060 * <ul class='doctree'>
061 *    <li class='extlink'>{@doc RFC2616}
062 * </ul>
063 */
064@Header("If-Unmodified-Since")
065public final class IfUnmodifiedSince extends HeaderDate {
066
067   /**
068    * Returns a parsed <code>If-Unmodified-Since</code> header.
069    *
070    * @param value The <code>If-Unmodified-Since</code> header string.
071    * @return The parsed <code>If-Unmodified-Since</code> header, or <jk>null</jk> if the string was null.
072    */
073   public static IfUnmodifiedSince forString(String value) {
074      if (value == null)
075         return null;
076      return new IfUnmodifiedSince(value);
077   }
078
079   private IfUnmodifiedSince(String value) {
080      super(value);
081   }
082}