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>ETag</l> HTTP response header. 019 * 020 * <p> 021 * An identifier for a specific version of a resource, often a message digest. 022 * 023 * <h5 class='figure'>Example</h5> 024 * <p class='bcode w800'> 025 * ETag: "737060cd8c284d8af7ad3082f209582d" 026 * </p> 027 * 028 * <h5 class='topic'>RFC2616 Specification</h5> 029 * 030 * The ETag response-header field provides the current value of the entity tag for the requested variant. 031 * The headers used with entity tags are described in sections 14.24, 14.26 and 14.44. 032 * The entity tag MAY be used for comparison with other entities from the same resource (see section 13.3.3). 033 * 034 * <p class='bcode w800'> 035 * ETag = "ETag" ":" entity-tag 036 * </p> 037 * 038 * <p> 039 * Examples: 040 * <p class='bcode w800'> 041 * ETag: "xyzzy" 042 * ETag: W/"xyzzy" 043 * ETag: "" 044 * </p> 045 * 046 * <ul class='seealso'> 047 * <li class='extlink'>{@doc RFC2616} 048 * </ul> 049 */ 050@Header("ETag") 051public final class ETag extends HeaderString { 052 053 /** 054 * Returns a parsed <c>ETag</c> header. 055 * 056 * @param value The <c>ETag</c> header string. 057 * @return The parsed <c>ETag</c> header, or <jk>null</jk> if the string was null. 058 */ 059 public static ETag forString(String value) { 060 if (value == null) 061 return null; 062 return new ETag(value); 063 } 064 065 private ETag(String value) { 066 super(value); 067 } 068}