All Implemented Interfaces:
Serializable, Header, NameValuePair

@Header("Allow") public class Allow extends BasicCsvHeader
Represents a parsed Allow HTTP response header.

Valid methods for a specified resource. To be used for a 405 Method not allowed.

Example

Allow: GET, HEAD

RFC2616 Specification
The Allow entity-header field lists the set of methods supported by the resource identified by the Request-URI. The purpose of this field is strictly to inform the recipient of valid methods associated with the resource. An Allow header field MUST be present in a 405 (Method Not Allowed) response.

Allow = "Allow" ":" #Method

Example of use:

Allow: GET, HEAD, PUT

This field cannot prevent a client from trying other methods. However, the indications given by the Allow header field value SHOULD be followed.

The actual set of allowed methods is defined by the origin server at the time of each request.

The Allow header field MAY be provided with a PUT request to recommend the methods to be supported by the new or modified resource.

The server is not required to support these methods and SHOULD include an Allow header in the response giving the actual supported methods.

A proxy MUST NOT modify the Allow header field even if it does not understand all the methods specified, since the user agent might have other means of communicating with the origin server.

See Also:
  • Constructor Details

    • Allow

      public Allow(String value)
      Constructor.
      Parameters:
      value - The header value.
      Can be null to create a header with no value.
    • Allow

      public Allow(String... value)
      Constructor.
      Parameters:
      value - The header value.
      Can be null or empty to create a header with no value.
    • Allow

      public Allow(Supplier<String[]> value)
      Constructor with delayed value.

      Header value is re-evaluated on each call to BasicCsvHeader.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null to create a header with no value.
  • Method Details

    • of

      public static Allow of(String value)
      Static creator.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • of

      public static Allow of(String... value)
      Static creator.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • of

      public static Allow of(String value1, String value2)
      Static creator for two CSV tokens.

      This distinct fixed-arity overload ensures two literal String arguments resolve to this class's own factory (returning an Allow) rather than the inherited fixed-arity BasicCsvHeader.of(String,String), which Java overload resolution would otherwise prefer.

      Parameters:
      value1 - The first CSV token.
      value2 - The second CSV token.
      Returns:
      A new header bean.
    • of

      public static Allow of(Supplier<String[]> value)
      Static creator with delayed value.

      Header value is re-evaluated on each call to BasicCsvHeader.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.