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>Transfer-Encoding</l> HTTP response header.
017 * 
018 * <p>
019 * The form of encoding used to safely transfer the entity to the user.
020 * Currently defined methods are: chunked, compress, deflate, gzip, identity.
021 * 
022 * <h5 class='figure'>Example</h5>
023 * <p class='bcode'>
024 *    Transfer-Encoding: chunked
025 * </p>
026 * 
027 * <h5 class='topic'>RFC2616 Specification</h5>
028 * 
029 * The Transfer-Encoding general-header field indicates what (if any) type of transformation has been applied to the
030 * message body in order to safely transfer it between the sender and the recipient.
031 * This differs from the content-coding in that the transfer-coding is a property of the message, not of the entity.
032 * 
033 * <p class='bcode'>
034 *    Transfer-Encoding       = "Transfer-Encoding" ":" 1#transfer-coding
035 * </p>
036 * 
037 * <p>
038 * Transfer-codings are defined in section 3.6. An example is:
039 * 
040 * <p class='bcode'>
041 *    Transfer-Encoding: chunked
042 * </p>
043 * 
044 * <p>
045 * If multiple encodings have been applied to an entity, the transfer-codings MUST be listed in the order in which
046 * they were applied.
047 * Additional information about the encoding parameters MAY be provided by other entity-header fields not defined by
048 * this specification.
049 * 
050 * <p>
051 * Many older HTTP/1.0 applications do not understand the Transfer-Encoding header.
052 * 
053 * <h5 class='section'>See Also:</h5>
054 * <ul class='doctree'>
055 *    <li class='extlink'><a class='doclink' href='https://www.w3.org/Protocols/rfc2616/rfc2616.html'>Hypertext Transfer Protocol -- HTTP/1.1</a>
056 * </ul>
057 */
058public final class TransferEncoding extends HeaderString {
059
060   /**
061    * Returns a parsed <code>Transfer-Encoding</code> header.
062    * 
063    * @param value The <code>Transfer-Encoding</code> header string.
064    * @return The parsed <code>Transfer-Encoding</code> header, or <jk>null</jk> if the string was null.
065    */
066   public static TransferEncoding forString(String value) {
067      if (value == null)
068         return null;
069      return new TransferEncoding(value);
070   }
071
072   private TransferEncoding(String value) {
073      super(value);
074   }
075}