Enum Class ContentType

java.lang.Object
java.lang.Enum<ContentType>
com.xxl.tool.http.http.enums.ContentType
All Implemented Interfaces:
Serializable, Comparable<ContentType>, Constable

public enum ContentType extends Enum<ContentType>
Content Type
  • Enum Constant Details

    • FORM_URLENCODED

      public static final ContentType FORM_URLENCODED
      标准表单编码,get请求时用x-www-form-urlencoded编码方式把form数据转换成一个字串(name1=value1&name2=value2…)
    • JSON

      public static final ContentType JSON
      JSON编码
    • XML

      public static final ContentType XML
      XML编码
    • TEXT_PLAIN

      public static final ContentType TEXT_PLAIN
      text/plain编码
    • TEXT_XML

      public static final ContentType TEXT_XML
      text/xml编码
    • TEXT_HTML

      public static final ContentType TEXT_HTML
      text/html编码
  • Method Details

    • values

      public static ContentType[] 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 ContentType 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
    • getValue

      public String getValue()
      获取 value
    • getValue

      public String getValue(Charset charset)
      获取 value + charset
           ContentType.JSON.getValue(StandardCharsets.UTF_8)   = application/json;charset=UTF-8
           ContentType.JSON.getValue()                         = application/json
       
    • toString

      public String toString()
      Overrides:
      toString in class Enum<ContentType>