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>Location</l> HTTP response header. 017 * 018 * <p> 019 * Used in redirection, or when a new resource has been created. 020 * 021 * <h5 class='figure'>Example</h5> 022 * <p class='bcode'> 023 * Location: http://www.w3.org/pub/WWW/People.html 024 * </p> 025 * 026 * <h5 class='topic'>RFC2616 Specification</h5> 027 * 028 * The Location response-header field is used to redirect the recipient to a location other than the Request-URI for 029 * completion of the request or identification of a new resource. 030 * For 201 (Created) responses, the Location is that of the new resource which was created by the request. 031 * For 3xx responses, the location SHOULD indicate the server's preferred URI for automatic redirection to the resource. 032 * The field value consists of a single absolute URI. 033 * 034 * <p class='bcode'> 035 * Location = "Location" ":" absoluteURI 036 * </p> 037 * 038 * <p> 039 * An example is: 040 * <p class='bcode'> 041 * Location: http://www.w3.org/pub/WWW/People.html 042 * </p> 043 * 044 * <p> 045 * Note: The Content-Location header field (section 14.14) differs from Location in that the Content-Location identifies 046 * the original location of the entity enclosed in the request. 047 * It is therefore possible for a response to contain header fields for both Location and Content-Location. 048 * Also see section 13.10 for cache requirements of some methods. 049 * 050 * <h5 class='section'>See Also:</h5> 051 * <ul class='doctree'> 052 * <li class='extlink'><a class='doclink' href='https://www.w3.org/Protocols/rfc2616/rfc2616.html'>Hypertext Transfer Protocol -- HTTP/1.1</a> 053 * </ul> 054 */ 055public final class Location extends HeaderUri { 056 057 /** 058 * Returns a parsed <code>Location</code> header. 059 * 060 * @param value The <code>Location</code> header string. 061 * @return The parsed <code>Location</code> header, or <jk>null</jk> if the string was null. 062 */ 063 public static Location forString(String value) { 064 if (value == null) 065 return null; 066 return new Location(value); 067 } 068 069 private Location(String value) { 070 super(value); 071 } 072}