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