001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.juneau.http.header; 018 019import java.util.function.*; 020 021import org.apache.juneau.http.annotation.*; 022 023/** 024 * Represents a parsed <l>Forwarded</l> HTTP request header. 025 * 026 * <h5 class='section'>See Also:</h5><ul> 027 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauRestCommonBasics">juneau-rest-common Basics</a> 028 * <li class='extlink'><a class="doclink" href="https://www.w3.org/Protocols/rfc2616/rfc2616.html">Hypertext Transfer Protocol -- HTTP/1.1</a> 029 * </ul> 030 * 031 * @serial exclude 032 */ 033@Header("Forwarded") 034public class Forwarded extends BasicStringHeader { 035 036 //----------------------------------------------------------------------------------------------------------------- 037 // Static 038 //----------------------------------------------------------------------------------------------------------------- 039 040 private static final long serialVersionUID = 1L; 041 private static final String NAME = "Forwarded"; 042 043 /** 044 * Static creator. 045 * 046 * @param value 047 * The header value. 048 * <br>Can be <jk>null</jk>. 049 * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>. 050 */ 051 public static Forwarded of(String value) { 052 return value == null ? null : new Forwarded(value); 053 } 054 055 /** 056 * Static creator with delayed value. 057 * 058 * <p> 059 * Header value is re-evaluated on each call to {@link #getValue()}. 060 * 061 * @param value 062 * The supplier of the header value. 063 * <br>Can be <jk>null</jk>. 064 * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>. 065 */ 066 public static Forwarded of(Supplier<String> value) { 067 return value == null ? null : new Forwarded(value); 068 } 069 070 //----------------------------------------------------------------------------------------------------------------- 071 // Instance 072 //----------------------------------------------------------------------------------------------------------------- 073 074 /** 075 * Constructor. 076 * 077 * @param value 078 * The header value. 079 * <br>Can be <jk>null</jk>. 080 */ 081 public Forwarded(String value) { 082 super(NAME, value); 083 } 084 085 /** 086 * Constructor with delayed value. 087 * 088 * <p> 089 * Header value is re-evaluated on each call to {@link #getValue()}. 090 * 091 * @param value 092 * The supplier of the header value. 093 * <br>Can be <jk>null</jk>. 094 */ 095 public Forwarded(Supplier<String> value) { 096 super(NAME, value); 097 } 098}