public class ContentType extends Object implements Serializable
Description:
| 限定符和类型 | 字段和说明 |
|---|---|
static ContentType |
APPLICATION_FORM_URLENCODED |
static ContentType |
APPLICATION_JSON |
static ContentType |
DEFAULT_BINARY |
static ContentType |
DEFAULT_TEXT |
static ContentType |
MULTIPART_FORM_DATA |
| 限定符和类型 | 方法和说明 |
|---|---|
static ContentType |
create(MimeType mimeType,
Charset charset) |
static ContentType |
create(String mimeType) |
static ContentType |
create(String mimeType,
Charset charset) |
static ContentType |
create(String mimeType,
NameValue... params)
Creates a new instance of
ContentType with the given parameters. |
static ContentType |
create(String mimeType,
String charset) |
Charset |
getCharset() |
MimeType |
getMimeType() |
String |
getParameter(String name) |
String |
toString()
Generates textual representation of this content type which can be used
as the value of a
Content-Type header. |
static String |
toString(List<ContentType> contentTypes) |
ContentType |
withParameters(NameValue... params)
Creates a new instance with this MIME type and the given parameters.
|
public static final ContentType APPLICATION_JSON
public static final ContentType APPLICATION_FORM_URLENCODED
public static final ContentType MULTIPART_FORM_DATA
public static final ContentType DEFAULT_BINARY
public static final ContentType DEFAULT_TEXT
public MimeType getMimeType()
public Charset getCharset()
public String toString()
Content-Type header.public static String toString(List<ContentType> contentTypes)
public static ContentType create(MimeType mimeType, Charset charset)
public static ContentType create(String mimeType)
public static ContentType create(String mimeType, String charset) throws UnsupportedCharsetException
public static ContentType create(String mimeType, Charset charset)
public static ContentType create(String mimeType, NameValue... params) throws UnsupportedCharsetException
ContentType with the given parameters.mimeType - MIME type. It may not be null or empty. It may not contain
characters <">, <;>, <,> reserved by the HTTP specification.params - parameters.UnsupportedCharsetExceptionpublic ContentType withParameters(NameValue... params) throws UnsupportedCharsetException
params - UnsupportedCharsetExceptionCopyright © 2019. All rights reserved.