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>Pragma</l> HTTP request/response header.
019 *
020 * <p>
021 * Implementation-specific fields that may have various effects anywhere along the request-response chain.
022 *
023 * <h5 class='figure'>Example</h5>
024 * <p class='bcode w800'>
025 *    Pragma: no-cache
026 * </p>
027 *
028 * <h5 class='topic'>RFC2616 Specification</h5>
029 *
030 * The Pragma general-header field is used to include implementation- specific directives that might apply to any
031 * recipient along the request/response chain.
032 * All pragma directives specify optional behavior from the viewpoint of the protocol; however, some systems MAY
033 * require that behavior be consistent with the directives.
034 *
035 * <p class='bcode w800'>
036 *    Pragma            = "Pragma" ":" 1#pragma-directive
037 *    pragma-directive  = "no-cache" | extension-pragma
038 *    extension-pragma  = token [ "=" ( token | quoted-string ) ]
039 * </p>
040 *
041 * <p>
042 * When the no-cache directive is present in a request message, an application SHOULD forward the request toward the
043 * origin server even if it has a cached copy of what is being requested.
044 * This pragma directive has the same semantics as the no-cache cache-directive (see section 14.9) and is defined here
045 * for backward compatibility with HTTP/1.0.
046 * Clients SHOULD include both header fields when a no-cache request is sent to a server not known to be HTTP/1.1
047 * compliant.
048 *
049 * <p>
050 * Pragma directives MUST be passed through by a proxy or gateway application, regardless of their significance to that
051 * application, since the directives might be applicable to all recipients along the request/response chain.
052 * It is not possible to specify a pragma for a specific recipient; however, any pragma directive not relevant to a
053 * recipient SHOULD be ignored by that recipient.
054 *
055 * <p>
056 * HTTP/1.1 caches SHOULD treat "Pragma: no-cache" as if the client had sent "Cache-Control: no-cache".
057 * No new Pragma directives will be defined in HTTP.
058 *
059 * <p>
060 * Note: because the meaning of "Pragma: no-cache as a response header field is not actually specified, it does not
061 * provide a reliable replacement for "Cache-Control: no-cache" in a response.
062 *
063 * <ul class='seealso'>
064 *    <li class='extlink'>{@doc RFC2616}
065 * </ul>
066 */
067@Header("Pragma")
068public final class Pragma extends HeaderString {
069
070   /**
071    * Returns a parsed <c>Pragma</c> header.
072    *
073    * @param value The <c>Pragma</c> header string.
074    * @return The parsed <c>Pragma</c> header, or <jk>null</jk> if the string was null.
075    */
076   public static Pragma forString(String value) {
077      if (value == null)
078         return null;
079      return new Pragma(value);
080   }
081
082   private Pragma(String value) {
083      super(value);
084   }
085}