public enum ContentType extends Enum<ContentType>
| 枚举常量和说明 |
|---|
FORM_URLENCODED
标准表单编码,当action为get时候,浏览器用x-www-form-urlencoded的编码方式把form数据转换成一个字串(name1=value1&name2=value2…)
|
JSON
Rest请求JSON编码
|
MULTIPART
文件上传编码,浏览器会把整个表单以控件为单位分割,并为每个部分加上Content-Disposition,并加上分割符(boundary)
|
TEXT_XML
Rest请求text/xml编码
|
XML
Rest请求XML编码
|
| 限定符和类型 | 方法和说明 |
|---|---|
static ContentType |
get(String body)
从请求参数的body中判断请求的Content-Type类型,支持的类型有:
application/json
application/xml
|
static boolean |
isFormUrlEncoded(String contentType) |
String |
toString() |
String |
toString(Charset charset) |
String |
toString(String charset) |
static ContentType |
valueOf(String name)
返回带有指定名称的该类型的枚举常量。
|
static ContentType[] |
values()
按照声明该枚举类型的常量的顺序, 返回
包含这些常量的数组。
|
public static final ContentType FORM_URLENCODED
public static final ContentType MULTIPART
public static final ContentType JSON
public static final ContentType XML
public static final ContentType TEXT_XML
public static ContentType[] values()
for (ContentType c : ContentType.values()) System.out.println(c);
public static ContentType valueOf(String name)
name - 要返回的枚举常量的名称。IllegalArgumentException - 如果该枚举类型没有带有指定名称的常量NullPointerException - 如果参数为空值public String toString()
toString 在类中 Enum<ContentType>public static boolean isFormUrlEncoded(String contentType)
public static ContentType get(String body)
Copyright © 2024 fossc. All rights reserved.