Enum HttpMethod

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.CharSequence, java.lang.Comparable<HttpMethod>

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

      Enum Constants 
      Enum Constant Description
      CONNECT
      See https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.9.
      CUSTOM
      A custom non-standard HTTP method.
      DELETE
      See https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.7.
      GET
      See https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.3.
      HEAD
      See https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.4.
      OPTIONS
      See https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.2.
      PATCH
      See https://tools.ietf.org/html/rfc5789.
      POST
      See https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.5.
      PUT
      See https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6.
      TRACE
      See https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.8.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      char charAt​(int index)  
      int length()  
      static HttpMethod parse​(java.lang.String httpMethodName)  
      static boolean permitsRequestBody​(HttpMethod method)
      Whether the given method allows a request body.
      static boolean requiresRequestBody​(HttpMethod method)
      Whether the given method requires a request body.
      java.lang.CharSequence subSequence​(int start, int end)  
      static HttpMethod valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static HttpMethod[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.CharSequence

        chars, codePoints, toString
    • Enum Constant Detail

      • 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.
      • HEAD

        public static final HttpMethod HEAD
        See https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.4.
      • 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 Detail

      • values

        public static HttpMethod[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (HttpMethod c : HttpMethod.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static HttpMethod valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • length

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

        public char charAt​(int index)
        Specified by:
        charAt in interface java.lang.CharSequence
      • subSequence

        public java.lang.CharSequence subSequence​(int start,
                                                  int end)
        Specified by:
        subSequence in interface java.lang.CharSequence
      • 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​(java.lang.String httpMethodName)
        Parameters:
        httpMethodName - Name of the http method (may be nonstandard)
        Returns:
        the value of enum (CUSTOM by default).