public interface MediaType
Can also represent a non existent (i.e. empty) value.
Modifier and Type | Field and Description |
---|---|
static String |
APPLICATION_FORM
"application/x-www-form-urlencoded".
|
static String |
APPLICATION_JSON
"application/json".
|
static String |
PLAIN_TEXT_UTF8
"text/plain;charset=utf-8".
|
static String |
TEXT_HTML
"text/html".
|
Modifier and Type | Method and Description |
---|---|
String |
getCharset()
The value of the "charset" parameter, or the HTTP default of
"ISO-8859-1" . |
Map<String,String> |
getParams()
The parameters of the mime type.
|
String |
getType()
The type without parameters.
|
boolean |
isEmpty()
True if this represents the absence of a value (i.e.
|
boolean |
isForm()
True if this type equals "application/x-www-form-urlencoded".
|
boolean |
isHtml()
True if this type equals "text/html".
|
boolean |
isJson()
True if this type equals "application/json".
|
boolean |
isText()
True if this type starts with "
text/ ". |
static final String PLAIN_TEXT_UTF8
static final String APPLICATION_JSON
static final String APPLICATION_FORM
static final String TEXT_HTML
@Nullable String getType()
Given a mime type of "text/plain;charset=utf-8", returns "text/plain".
May be null to represent no content type.
Map<String,String> getParams()
Given a mime type of "application/json;charset=utf-8", returns [charset: "utf-8"]
".
May be empty, never null.
All param names have been lower cased.
String getCharset()
"ISO-8859-1"
.
This method always returns a value, even if the actual type is a binary type.
"ISO-8859-1"
.boolean isText()
text/
".text/
".boolean isJson()
boolean isForm()
boolean isHtml()
boolean isEmpty()