public class MediaType
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
APPLICATION_ATOM_XML |
static MediaType |
APPLICATION_ATOM_XML_TYPE |
static java.lang.String |
APPLICATION_FORM_URLENCODED |
static MediaType |
APPLICATION_FORM_URLENCODED_TYPE |
static java.lang.String |
APPLICATION_JSON |
static MediaType |
APPLICATION_JSON_TYPE |
static java.lang.String |
APPLICATION_OCTET_STREAM |
static MediaType |
APPLICATION_OCTET_STREAM_TYPE |
static java.lang.String |
APPLICATION_XHTML_XML |
static MediaType |
APPLICATION_XHTML_XML_TYPE |
static java.lang.String |
APPLICATION_XML |
static MediaType |
APPLICATION_XML_TYPE |
static java.lang.String |
MEDIA_TYPE_WILDCARD |
static java.lang.String |
MULTIPART_FORM_DATA |
static MediaType |
MULTIPART_FORM_DATA_TYPE |
static java.lang.String |
TEXT_HTML |
static MediaType |
TEXT_HTML_TYPE |
static java.lang.String |
TEXT_PLAIN |
static MediaType |
TEXT_PLAIN_TYPE |
static java.lang.String |
WILDCARD |
static MediaType |
WILDCARD_TYPE |
Constructor and Description |
---|
MediaType(java.lang.String typeDef)
Creates a new MediaType.
|
MediaType(java.lang.String type,
java.lang.String subType)
Creates a new MediaType.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
asString()
Returns the string representation (e.g.
|
boolean |
equals(java.lang.Object obj) |
static MediaType |
get(java.lang.String typeDef)
Returns the MediType object for the given type string.
|
java.lang.String |
getSubType() |
java.lang.String |
getType() |
int |
hashCode() |
protected void |
init(java.lang.String main,
java.lang.String sub) |
boolean |
isType(java.lang.String typeDef)
Returns true if the given string equals (case-insensitive) the receiver's
string representation.
|
boolean |
isWildcardSubType() |
boolean |
isWildcardType() |
protected void |
setSubType(java.lang.String subType) |
protected void |
setType(java.lang.String type) |
java.lang.String |
toString() |
public static final java.lang.String MEDIA_TYPE_WILDCARD
public static final MediaType WILDCARD_TYPE
public static final java.lang.String WILDCARD
public static final MediaType TEXT_PLAIN_TYPE
public static final java.lang.String TEXT_PLAIN
public static final MediaType TEXT_HTML_TYPE
public static final java.lang.String TEXT_HTML
public static final MediaType APPLICATION_FORM_URLENCODED_TYPE
public static final java.lang.String APPLICATION_FORM_URLENCODED
public static final MediaType MULTIPART_FORM_DATA_TYPE
public static final java.lang.String MULTIPART_FORM_DATA
public static final MediaType APPLICATION_ATOM_XML_TYPE
public static final java.lang.String APPLICATION_ATOM_XML
public static final MediaType APPLICATION_JSON_TYPE
public static final java.lang.String APPLICATION_JSON
public static final MediaType APPLICATION_XML_TYPE
public static final java.lang.String APPLICATION_XML
public static final MediaType APPLICATION_XHTML_XML_TYPE
public static final java.lang.String APPLICATION_XHTML_XML
public static final MediaType APPLICATION_OCTET_STREAM_TYPE
public static final java.lang.String APPLICATION_OCTET_STREAM
public MediaType(java.lang.String type, java.lang.String subType)
type
- The main type (must not be null).subType
- The sub type (must not be null).java.lang.IllegalArgumentException
- If any of the arguments is null.public MediaType(java.lang.String typeDef)
typeDef
- The type definition comprised of a main type and sub type separated by a slash (must not be null).java.lang.IllegalArgumentException
- If the arguments is null or blank or no valid media type definition.public static MediaType get(java.lang.String typeDef)
typeDef
- The type definition (e.g. "image/jpg") (must not be null).java.lang.IllegalArgumentException
- If the given typeDef is null or otherwise no valid media type definition.public java.lang.String asString()
public boolean isType(java.lang.String typeDef)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean isWildcardType()
public boolean isWildcardSubType()
public java.lang.String getType()
public java.lang.String getSubType()
protected void init(java.lang.String main, java.lang.String sub)
protected void setType(java.lang.String type)
protected void setSubType(java.lang.String subType)