Enum Class HttpMethod

java.lang.Object
java.lang.Enum<HttpMethod>
com.linecorp.armeria.common.HttpMethod
All Implemented Interfaces:
Serializable, Comparable<HttpMethod>, java.lang.constant.Constable

public enum HttpMethod extends Enum<HttpMethod>
HTTP request method.
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    The CONNECT method which is used for a proxy that can dynamically switch to being a tunnel or for bootstrapping WebSockets with HTTP/2.
    The DELETE method which requests that the origin server delete the resource identified by the Request-URI.
    The GET method which means retrieve whatever information (in the form of an entity) is identified by the Request-URI.
    The HEAD method which is identical to GET except that the server MUST NOT return a message-body in the response.
    The OPTIONS method which represents a request for information about the communication options available on the request/response chain identified by the Request-URI.
    The PATCH method which requests that a set of changes described in the request entity be applied to the resource identified by the Request-URI.
    The POST method which is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line.
    The PUT method which requests that the enclosed entity be stored under the supplied Request-URI.
    The TRACE method which is used to invoke a remote, application-layer loop-back of the request message.
    A special constant returned by RequestHeaderGetters.method() to signify that a request has a method not defined in this enum.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Set<HttpMethod>
    Returns the idempotent HTTP methods - GET, HEAD, PUT and DELETE.
    static boolean
    isSupported​(String value)
    Returns whether the specified String is one of the supported method names.
    static Set<HttpMethod>
    Returns all HttpMethods except UNKNOWN.
    Parses the specified String into an HttpMethod.
    static HttpMethod
    valueOf​(String name)
    Returns the enum constant of this class with the specified name.
    static HttpMethod[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • OPTIONS

      public static final HttpMethod OPTIONS
      The OPTIONS method which represents a request for information about the communication options available on the request/response chain identified by the Request-URI. This method allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval.
    • GET

      public static final HttpMethod GET
      The GET method which means retrieve whatever information (in the form of an entity) is identified by the Request-URI. If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the entity in the response and not the source text of the process, unless that text happens to be the output of the process.
    • POST

      public static final HttpMethod POST
      The POST method which is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line.
    • PUT

      public static final HttpMethod PUT
      The PUT method which requests that the enclosed entity be stored under the supplied Request-URI.
    • PATCH

      public static final HttpMethod PATCH
      The PATCH method which requests that a set of changes described in the request entity be applied to the resource identified by the Request-URI.
    • DELETE

      public static final HttpMethod DELETE
      The DELETE method which requests that the origin server delete the resource identified by the Request-URI.
    • TRACE

      public static final HttpMethod TRACE
      The TRACE method which is used to invoke a remote, application-layer loop-back of the request message.
    • CONNECT

      public static final HttpMethod CONNECT
      The CONNECT method which is used for a proxy that can dynamically switch to being a tunnel or for bootstrapping WebSockets with HTTP/2. Note that Armeria handles a CONNECT request only for bootstrapping WebSockets.
    • UNKNOWN

      public static final HttpMethod UNKNOWN
      A special constant returned by RequestHeaderGetters.method() to signify that a request has a method not defined in this enum.
  • Method Details

    • values

      public static HttpMethod[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static HttpMethod valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • isSupported

      public static boolean isSupported(String value)
      Returns whether the specified String is one of the supported method names.
      Returns:
      true if supported. false otherwise.
    • idempotentMethods

      public static Set<HttpMethod> idempotentMethods()
      Returns the idempotent HTTP methods - GET, HEAD, PUT and DELETE.
    • knownMethods

      public static Set<HttpMethod> knownMethods()
      Returns all HttpMethods except UNKNOWN.
    • tryParse

      @Nullable public static @Nullable HttpMethod tryParse(@Nullable @Nullable String method)
      Parses the specified String into an HttpMethod. This method will return the same HttpMethod instance for equal values of method. Note that this method will not treat "UNKNOWN" as a valid value and thus will return null when "UNKNOWN" is given.
      Returns:
      null if there is no such HttpMethod available