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>From</l> HTTP request header.
019 *
020 * <p>
021 * The email address of the user making the request.
022 *
023 * <h5 class='figure'>Example</h5>
024 * <p class='bcode w800'>
025 *    From: user@example.com
026 * </p>
027 *
028 * <h5 class='topic'>RFC2616 Specification</h5>
029 *
030 * The From request-header field, if given, SHOULD contain an Internet e-mail address for the human user who controls
031 * the requesting user agent.
032 * The address SHOULD be machine-usable, as defined by "mailbox" in RFC 822 [9] as updated by RFC 1123 [8]:
033 *
034 * <p class='bcode w800'>
035 *    From   = "From" ":" mailbox
036 * </p>
037 *
038 * <p>
039 * An example is:
040 * <p class='bcode w800'>
041 *    From: webmaster@w3.org
042 * </p>
043 *
044 * <p>
045 * This header field MAY be used for logging purposes and as a means for identifying the source of invalid or unwanted
046 * requests.
047 * It SHOULD NOT be used as an insecure form of access protection.
048 * The interpretation of this field is that the request is being performed on behalf of the person given, who accepts
049 * responsibility for the method performed.
050 * In particular, robot agents SHOULD include this header so that the person responsible for running the robot can be
051 * contacted if problems occur on the receiving end.
052 *
053 * <p>
054 * The Internet e-mail address in this field MAY be separate from the Internet host which issued the request.
055 * For example, when a request is passed through a proxy the original issuer's address SHOULD be used.
056 *
057 * <p>
058 * The client SHOULD NOT send the From header field without the user's approval, as it might conflict with the user's
059 * privacy interests or their site's security policy.
060 * It is strongly recommended that the user be able to disable, enable, and modify the value of this field at any time
061 * prior to a request.
062 *
063 * <ul class='seealso'>
064 *    <li class='extlink'>{@doc RFC2616}
065 * </ul>
066 */
067@Header("From")
068public final class From extends HeaderString {
069
070   /**
071    * Returns a parsed <c>From</c> header.
072    *
073    * @param value The <c>From</c> header string.
074    * @return The parsed <c>From</c> header, or <jk>null</jk> if the string was null.
075    */
076   public static From forString(String value) {
077      if (value == null)
078         return null;
079      return new From(value);
080   }
081
082   private From(String value) {
083      super(value);
084   }
085}