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>Max-Forwards</l> HTTP request header. 017 * 018 * <p> 019 * Limit the number of times the message can be forwarded through proxies or gateways. 020 * 021 * <h5 class='figure'>Example</h5> 022 * <p class='bcode'> 023 * Max-Forwards: 10 024 * </p> 025 * 026 * <h5 class='topic'>RFC2616 Specification</h5> 027 * 028 * The Max-Forwards request-header field provides a mechanism with the TRACE (section 9.8) and OPTIONS (section 9.2) 029 * methods to limit the number of proxies or gateways that can forward the request to the next inbound server. 030 * This can be useful when the client is attempting to trace a request chain which appears to be failing or looping in 031 * mid-chain. 032 * 033 * <p class='bcode'> 034 * Max-Forwards = "Max-Forwards" ":" 1*DIGIT 035 * </p> 036 * 037 * <p> 038 * The Max-Forwards value is a decimal integer indicating the remaining number of times this request message may be 039 * forwarded. 040 * 041 * <p> 042 * Each proxy or gateway recipient of a TRACE or OPTIONS request containing a Max-Forwards header field MUST check and 043 * update its value prior to forwarding the request. 044 * If the received value is zero (0), the recipient MUST NOT forward the request; instead, it MUST respond as the final 045 * recipient. 046 * If the received Max-Forwards value is greater than zero, then the forwarded message MUST contain an updated 047 * Max-Forwards field with a value decremented by one (1). 048 * 049 * <p> 050 * The Max-Forwards header field MAY be ignored for all other methods defined by this specification and for any 051 * extension methods for which it is not explicitly referred to as part of that method definition. 052 * 053 * <h5 class='section'>See Also:</h5> 054 * <ul class='doctree'> 055 * <li class='extlink'><a class='doclink' href='https://www.w3.org/Protocols/rfc2616/rfc2616.html'>Hypertext Transfer Protocol -- HTTP/1.1</a> 056 * </ul> 057 */ 058public final class MaxForwards extends HeaderInteger { 059 060 /** 061 * Returns a parsed <code>Max-Forwards</code> header. 062 * 063 * @param value The <code>Max-Forwards</code> header string. 064 * @return The parsed <code>Max-Forwards</code> header, or <jk>null</jk> if the string was null. 065 */ 066 public static MaxForwards forString(String value) { 067 if (value == null) 068 return null; 069 return new MaxForwards(value); 070 } 071 072 private MaxForwards(String value) { 073 super(value); 074 } 075}