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