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 private static final long serialVersionUID = 1L; 036 private static final String NAME = "Forwarded"; 037 038 /** 039 * Static creator. 040 * 041 * @param value 042 * The header value. 043 * <br>Can be <jk>null</jk>. 044 * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>. 045 */ 046 public static Forwarded of(String value) { 047 return value == null ? null : new Forwarded(value); 048 } 049 050 /** 051 * Static creator with delayed value. 052 * 053 * <p> 054 * Header value is re-evaluated on each call to {@link #getValue()}. 055 * 056 * @param value 057 * The supplier of the header value. 058 * <br>Can be <jk>null</jk>. 059 * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>. 060 */ 061 public static Forwarded of(Supplier<String> value) { 062 return value == null ? null : new Forwarded(value); 063 } 064 065 /** 066 * Constructor. 067 * 068 * @param value 069 * The header value. 070 * <br>Can be <jk>null</jk>. 071 */ 072 public Forwarded(String value) { 073 super(NAME, value); 074 } 075 076 /** 077 * Constructor with delayed value. 078 * 079 * <p> 080 * Header value is re-evaluated on each call to {@link #getValue()}. 081 * 082 * @param value 083 * The supplier of the header value. 084 * <br>Can be <jk>null</jk>. 085 */ 086 public Forwarded(Supplier<String> value) { 087 super(NAME, value); 088 } 089}