Package com.helger.http
Enum Class EHttpMethod
- All Implemented Interfaces:
com.helger.base.name.IHasName,Serializable,Comparable<EHttpMethod>,Constable
HTTP methods as defined in RFC 9110 (HTTP Semantics) and RFC 5789 (PATCH).
- Author:
- Philip Helger
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable EHttpMethodgetFromNameOrDefault(@Nullable String sName, @Nullable EHttpMethod eDefault) Get the enum value matching the provided name, or a default value.static @Nullable EHttpMethodgetFromNameOrNull(@Nullable String sName) Get the enum value matching the provided name.@NonNull @Nonempty StringgetName()booleanbooleanbooleanstatic EHttpMethodReturns the enum constant of this class with the specified name.static EHttpMethod[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
OPTIONS
-
GET
-
HEAD
-
POST
-
PUT
-
DELETE
-
TRACE
-
CONNECT
-
PATCH
Extension as of RFC 5789 - partial PUT
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
getName
- Specified by:
getNamein interfacecom.helger.base.name.IHasName
-
isIdempodent
public boolean isIdempodent()- Returns:
trueif this HTTP method is idempotent (GET, HEAD, PUT, DELETE, OPTIONS, TRACE),falseotherwise.
-
isContentAllowed
public boolean isContentAllowed()- Returns:
trueif the response to this HTTP method may contain a body. This isfalseonly for HEAD.
-
isPayloadInBody
public boolean isPayloadInBody()- Returns:
trueif this HTTP method typically carries a payload in the request body (POST, PUT, PATCH),falseotherwise.
-
getFromNameOrNull
Get the enum value matching the provided name.- Parameters:
sName- The name to search. May benull.- Returns:
nullif no matching enum value was found.
-
getFromNameOrDefault
public static @Nullable EHttpMethod getFromNameOrDefault(@Nullable String sName, @Nullable EHttpMethod eDefault) Get the enum value matching the provided name, or a default value.- Parameters:
sName- The name to search. May benull.eDefault- The default value to return if no match is found. May benull.- Returns:
- The matching enum value or the provided default.
-