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