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>Allow</l> HTTP response header. 017 * 018 * <p> 019 * Valid methods for a specified resource. To be used for a 405 Method not allowed. 020 * 021 * <h5 class='figure'>Example</h5> 022 * <p class='bcode'> 023 * Allow: GET, HEAD 024 * </p> 025 * 026 * <h5 class='topic'>RFC2616 Specification</h5> 027 * 028 * The Allow entity-header field lists the set of methods supported by the resource identified by the Request-URI. 029 * The purpose of this field is strictly to inform the recipient of valid methods associated with the resource. 030 * An Allow header field MUST be present in a 405 (Method Not Allowed) response. 031 * 032 * <p class='bcode'> 033 * Allow = "Allow" ":" #Method 034 * </p> 035 * 036 * <p> 037 * Example of use: 038 * <p class='bcode'> 039 * Allow: GET, HEAD, PUT 040 * </p> 041 * 042 * <p> 043 * This field cannot prevent a client from trying other methods. 044 * However, the indications given by the Allow header field value SHOULD be followed. 045 * 046 * <p> 047 * The actual set of allowed methods is defined by the origin server at the time of each request. 048 * 049 * <p> 050 * The Allow header field MAY be provided with a PUT request to recommend the methods to be supported by the new or 051 * modified resource. 052 * 053 * <p> 054 * The server is not required to support these methods and SHOULD include an Allow header in the response giving the 055 * actual supported methods. 056 * 057 * <p> 058 * A proxy MUST NOT modify the Allow header field even if it does not understand all the methods specified, since the 059 * user agent might 060 * have other means of communicating with the origin server. 061 * 062 * <h5 class='section'>See Also:</h5> 063 * <ul class='doctree'> 064 * <li class='extlink'><a class='doclink' href='https://www.w3.org/Protocols/rfc2616/rfc2616.html'>Hypertext Transfer Protocol -- HTTP/1.1</a> 065 * </ul> 066 */ 067public final class Allow extends HeaderStringArray { 068 069 /** 070 * Returns a parsed <code>Allow</code> header. 071 * 072 * @param value The <code>Allow</code> header string. 073 * @return The parsed <code>Allow</code> header, or <jk>null</jk> if the string was null. 074 */ 075 public static Allow forString(String value) { 076 if (value == null) 077 return null; 078 return new Allow(value); 079 } 080 081 private Allow(String value) { 082 super(value); 083 } 084}