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