Enum Class HttpMethod

java.lang.Object
java.lang.Enum<HttpMethod>
io.micronaut.http.HttpMethod
All Implemented Interfaces:
Serializable, CharSequence, Comparable<HttpMethod>, Constable

public enum HttpMethod extends Enum<HttpMethod> implements CharSequence
An enum containing the valid HTTP methods. See https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html.
Since:
1.0
Author:
Graeme Rocher
  • Enum Constant Details

    • OPTIONS

      public static final HttpMethod OPTIONS
      See https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.2.
    • GET

      public static final HttpMethod GET
      See https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.3.
    • POST

      public static final HttpMethod POST
      See https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.5.
    • PUT

      public static final HttpMethod PUT
      See https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6.
    • DELETE

      public static final HttpMethod DELETE
      See https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.7.
    • TRACE

      public static final HttpMethod TRACE
      See https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.8.
    • CONNECT

      public static final HttpMethod CONNECT
      See https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.9.
    • PATCH

      public static final HttpMethod PATCH
      See https://tools.ietf.org/html/rfc5789.
    • CUSTOM

      public static final HttpMethod CUSTOM
      A custom non-standard HTTP method.
  • 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
    • length

      public int length()
      Specified by:
      length in interface CharSequence
    • charAt

      public char charAt(int index)
      Specified by:
      charAt in interface CharSequence
    • subSequence

      public CharSequence subSequence(int start, int end)
      Specified by:
      subSequence in interface CharSequence
    • requiresRequestBody

      public boolean requiresRequestBody()
      Whether the given method requires a request body.
      Returns:
      Does the method require a request body.
      Since:
      4.0.0
    • permitsRequestBody

      public boolean permitsRequestBody()
      Whether the given method allows a request body.
      Returns:
      Does the method allows a request body.
      Since:
      4.0.0
    • permitsResponseBody

      public boolean permitsResponseBody()
      Whether the given method allows a request body.
      Returns:
      Does the method allows a request body.
      Since:
      4.0.0
    • requiresRequestBody

      public static boolean requiresRequestBody(HttpMethod method)
      Whether the given method requires a request body.
      Parameters:
      method - The HttpMethod
      Returns:
      True if it does
    • permitsRequestBody

      public static boolean permitsRequestBody(HttpMethod method)
      Whether the given method allows a request body.
      Parameters:
      method - The HttpMethod
      Returns:
      True if it does
    • parse

      public static HttpMethod parse(String httpMethodName)
      Parameters:
      httpMethodName - Name of the http method (maybe nonstandard)
      Returns:
      the value of enum (CUSTOM by default).