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-Location</l> HTTP response header.
019 *
020 * <p>
021 * An alternate location for the returned data.
022 *
023 * <h5 class='figure'>Example</h5>
024 * <p class='bcode w800'>
025 *    Content-Location: /index.htm
026 * </p>
027 *
028 * <h5 class='topic'>RFC2616 Specification</h5>
029 *
030 * The Content-Location entity-header field MAY be used to supply the resource location for the entity enclosed in the
031 * message when that entity is accessible from a location separate from the requested resource's URI.
032 * A server SHOULD provide a Content-Location for the variant corresponding to the response entity; especially in the
033 * case where a resource has multiple entities associated with it, and those entities actually have separate locations
034 * by which they might be individually accessed, the server SHOULD provide a Content-Location for the particular variant
035 * which is returned.
036 * <p class='bcode w800'>
037 *    Content-Location = "Content-Location" ":"
038 *                       ( absoluteURI | relativeURI )
039 * </p>
040 *
041 * <p>
042 * The value of Content-Location also defines the base URI for the entity.
043 *
044 * <p>
045 * The Content-Location value is not a replacement for the original requested URI; it is only a statement of the
046 * location of the resource corresponding to this particular entity at the time of the request.
047 * Future requests MAY specify the Content-Location URI as the request- URI if the desire is to identify the source of
048 * that particular entity.
049 *
050 * <p>
051 * A cache cannot assume that an entity with a Content-Location different from the URI used to retrieve it can be used
052 * to respond to later requests on that Content-Location URI.
053 * However, the Content- Location can be used to differentiate between multiple entities retrieved from a single
054 * requested resource, as described in section 13.6.
055 *
056 * <p>
057 * If the Content-Location is a relative URI, the relative URI is interpreted relative to the Request-URI.
058 *
059 * <p>
060 * The meaning of the Content-Location header in PUT or POST requests is undefined; servers are free to ignore it in
061 * those cases.
062 *
063 * <h5 class='section'>See Also:</h5>
064 * <ul class='doctree'>
065 *    <li class='extlink'>{@doc RFC2616}
066 * </ul>
067 */
068@Header("Content-Location")
069public final class ContentLocation extends HeaderUri {
070
071   /**
072    * Returns a parsed <code>Content-Location</code> header.
073    *
074    * @param value The <code>Content-Location</code> header string.
075    * @return The parsed <code>Content-Location</code> header, or <jk>null</jk> if the string was null.
076    */
077   public static ContentLocation forString(String value) {
078      if (value == null)
079         return null;
080      return new ContentLocation(value);
081   }
082
083   private ContentLocation(String value) {
084      super(value);
085   }
086}