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 * <h5 class='section'>See Also:</h5> 064 * <ul class='doctree'> 065 * <li class='extlink'>{@doc RFC2616} 066 * </ul> 067 */ 068@Header("Pragma") 069public final class Pragma extends HeaderString { 070 071 /** 072 * Returns a parsed <code>Pragma</code> header. 073 * 074 * @param value The <code>Pragma</code> header string. 075 * @return The parsed <code>Pragma</code> header, or <jk>null</jk> if the string was null. 076 */ 077 public static Pragma forString(String value) { 078 if (value == null) 079 return null; 080 return new Pragma(value); 081 } 082 083 private Pragma(String value) { 084 super(value); 085 } 086}