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 (the 006 * "License"); you may not use this file except in compliance with the 007 * 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 019 020import java.util.function.*; 021 022/** 023 * Represents an HTTP <c>Max-Forwards</c> header. 024 * 025 * <p> 026 * Remaining number of times a request may be forwarded. 027 * 028 * @since 9.2.1 029 */ 030public class MaxForwards extends HttpIntegerHeader { 031 032 public static final String NAME = "Max-Forwards"; 033 034 public MaxForwards(String value) { 035 super(NAME, value); 036 } 037 038 public MaxForwards(int value) { 039 super(NAME, Integer.valueOf(value)); 040 } 041 042 public MaxForwards(Integer value) { 043 super(NAME, value); 044 } 045 046 private MaxForwards(Supplier<?> supplier, int lazyMode) { 047 super(NAME, supplier, lazyMode); 048 } 049 050 public static MaxForwards of(String value) { 051 return new MaxForwards(value); 052 } 053 054 public static MaxForwards of(int value) { 055 return new MaxForwards(value); 056 } 057 058 public static MaxForwards of(Integer value) { 059 return new MaxForwards(value); 060 } 061 062 public static MaxForwards ofLazyWire(Supplier<String> supplier) { 063 return new MaxForwards(supplier, LAZY_WIRE_STRING); 064 } 065 066 public static MaxForwards ofLazyParsed(Supplier<Integer> supplier) { 067 return new MaxForwards(supplier, LAZY_INTEGER); 068 } 069}