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>Referer</l> HTTP request header.
017 * 
018 * <p>
019 * This is the address of the previous web page from which a link to the currently requested page was followed.
020 * (The word “referrer” has been misspelled in the RFC as well as in most implementations to the point that it has
021 * become standard usage and is considered correct terminology)
022 * 
023 * <h5 class='figure'>Example</h5>
024 * <p class='bcode'>
025 *    Referer: http://en.wikipedia.org/wiki/Main_Page
026 * </p>
027 * 
028 * <h5 class='topic'>RFC2616 Specification</h5>
029 * 
030 * The Referer[sic] request-header field allows the client to specify, for the server's benefit, the address (URI) of
031 * the resource from which the Request-URI was obtained (the "referrer", although the header field is misspelled.)
032 * The Referer request-header allows a server to generate lists of back-links to resources for interest, logging,
033 * optimized caching, etc.
034 * It also allows obsolete or mistyped links to be traced for maintenance.
035 * The Referer field MUST NOT be sent if the Request-URI was obtained from a source that does not have its own URI,
036 * such as input from the user keyboard.
037 * 
038 * <p class='bcode'>
039 *    Referer        = "Referer" ":" ( absoluteURI | relativeURI )
040 * </p>
041 * 
042 * <p>
043 * Example:
044 * <p class='bcode'>
045 *    Referer: http://www.w3.org/hypertext/DataSources/Overview.html
046 * </p>
047 * 
048 * <p>
049 * If the field value is a relative URI, it SHOULD be interpreted relative to the Request-URI.
050 * The URI MUST NOT include a fragment. See section 15.1.3 for security considerations.
051 * 
052 * <h5 class='section'>See Also:</h5>
053 * <ul class='doctree'>
054 *    <li class='extlink'><a class='doclink' href='https://www.w3.org/Protocols/rfc2616/rfc2616.html'>Hypertext Transfer Protocol -- HTTP/1.1</a>
055 * </ul>
056 */
057public final class Referer extends HeaderUri {
058
059   /**
060    * Returns a parsed <code>Referer</code> header.
061    * 
062    * @param value The <code>Referer</code> header string.
063    * @return The parsed <code>Referer</code> header, or <jk>null</jk> if the string was null.
064    */
065   public static Referer forString(String value) {
066      if (value == null)
067         return null;
068      return new Referer(value);
069   }
070
071   private Referer(String value) {
072      super(value);
073   }
074}