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