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>Content-Language</l> HTTP response header.
019 *
020 * <p>
021 * The natural language or languages of the intended audience for the enclosed content.
022 *
023 * <h5 class='figure'>Example</h5>
024 * <p class='bcode w800'>
025 *    Content-Language: da
026 * </p>
027 *
028 * <h5 class='topic'>RFC2616 Specification</h5>
029 *
030 * The Content-Language entity-header field describes the natural language(s) of the intended audience for the
031 * enclosed entity.
032 * Note that this might not be equivalent to all the languages used within the entity-body.
033 * <p class='bcode w800'>
034 *    Content-Language  = "Content-Language" ":" 1#language-tag
035 * </p>
036 *
037 * <p>
038 * Language tags are defined in section 3.10.
039 * The primary purpose of Content-Language is to allow a user to identify and differentiate entities according to the
040 * user's own preferred language.
041 * Thus, if the body content is intended only for a Danish-literate audience, the appropriate field is...
042 * <p class='bcode w800'>
043 *    Content-Language: da
044 * </p>
045 *
046 * <p>
047 * If no Content-Language is specified, the default is that the content is intended for all language audiences.
048 * This might mean that the sender does not consider it to be specific to any natural language, or that the sender
049 * does not know for which language it is intended.
050 *
051 * <p>
052 * Multiple languages MAY be listed for content that is intended for multiple audiences.
053 * For example, a rendition of the "Treaty of Waitangi," presented simultaneously in the original Maori and English
054 * versions, would call for...
055 * <p class='bcode w800'>
056 *    Content-Language: mi, en
057 * </p>
058 *
059 * <p>
060 * However, just because multiple languages are present within an entity does not mean that it is intended for
061 * multiple linguistic audiences.
062 * An example would be a beginner's language primer, such as "A First Lesson in Latin," which is clearly intended to
063 * be used by an English-literate audience.
064 * In this case, the Content-Language would properly only include "en".
065 *
066 * <p>
067 * Content-Language MAY be applied to any media type -- it is not limited to textual documents.
068 *
069 * <h5 class='section'>See Also:</h5>
070 * <ul class='doctree'>
071 *    <li class='extlink'>{@doc RFC2616}
072 * </ul>
073 */
074@Header("Content-Language")
075public final class ContentLanguage extends HeaderStringArray {
076
077   /**
078    * Constructor.
079    *
080    * @param value
081    */
082   public ContentLanguage(String[] value) {
083      super(value);
084   }
085
086   /**
087    * Returns a parsed <code>Content-Language</code> header.
088    *
089    * @param value The <code>Content-Language</code> header string.
090    * @return The parsed <code>Content-Language</code> header, or <jk>null</jk> if the string was null.
091    */
092   public static ContentLanguage forString(String value) {
093      if (value == null)
094         return null;
095      return new ContentLanguage(value);
096   }
097
098   private ContentLanguage(String value) {
099      super(value);
100   }
101}