Package io.micronaut.http
Enum HttpMethod
- java.lang.Object
-
- java.lang.Enum<HttpMethod>
-
- io.micronaut.http.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 CONNECTSee https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.9.CUSTOMA custom non-standard HTTP method.DELETESee https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.7.GETSee https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.3.HEADSee https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.4.OPTIONSSee https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.2.PATCHSee https://tools.ietf.org/html/rfc5789.POSTSee https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.5.PUTSee https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6.TRACESee 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 charcharAt(int index)intlength()static HttpMethodparse(java.lang.String httpMethodName)static booleanpermitsRequestBody(HttpMethod method)Whether the given method allows a request body.static booleanrequiresRequestBody(HttpMethod method)Whether the given method requires a request body.java.lang.CharSequencesubSequence(int start, int end)static HttpMethodvalueOf(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.
-
-
-
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 namejava.lang.NullPointerException- if the argument is null
-
length
public int length()
- Specified by:
lengthin interfacejava.lang.CharSequence
-
charAt
public char charAt(int index)
- Specified by:
charAtin interfacejava.lang.CharSequence
-
subSequence
public java.lang.CharSequence subSequence(int start, int end)- Specified by:
subSequencein interfacejava.lang.CharSequence
-
requiresRequestBody
public static boolean requiresRequestBody(HttpMethod method)
Whether the given method requires a request body.- Parameters:
method- TheHttpMethod- Returns:
- True if it does
-
permitsRequestBody
public static boolean permitsRequestBody(HttpMethod method)
Whether the given method allows a request body.- Parameters:
method- TheHttpMethod- 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).
-
-