Enum Class EHttpMethod

java.lang.Object
java.lang.Enum<EHttpMethod>
com.helger.http.EHttpMethod
All Implemented Interfaces:
com.helger.base.name.IHasName, Serializable, Comparable<EHttpMethod>, Constable

public enum EHttpMethod extends Enum<EHttpMethod> implements com.helger.base.name.IHasName
HTTP methods as defined in RFC 9110 (HTTP Semantics) and RFC 5789 (PATCH).
Author:
Philip Helger
  • Enum Constant Details

  • Method Details

    • values

      public static EHttpMethod[] 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 EHttpMethod 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
    • getName

      @Nonempty public @NonNull @Nonempty String getName()
      Specified by:
      getName in interface com.helger.base.name.IHasName
    • isIdempodent

      public boolean isIdempodent()
      Returns:
      true if this HTTP method is idempotent (GET, HEAD, PUT, DELETE, OPTIONS, TRACE), false otherwise.
    • isContentAllowed

      public boolean isContentAllowed()
      Returns:
      true if the response to this HTTP method may contain a body. This is false only for HEAD.
    • isPayloadInBody

      public boolean isPayloadInBody()
      Returns:
      true if this HTTP method typically carries a payload in the request body (POST, PUT, PATCH), false otherwise.
    • getFromNameOrNull

      public static @Nullable EHttpMethod getFromNameOrNull(@Nullable String sName)
      Get the enum value matching the provided name.
      Parameters:
      sName - The name to search. May be null.
      Returns:
      null if 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 be null.
      eDefault - The default value to return if no match is found. May be null.
      Returns:
      The matching enum value or the provided default.