@BeanIgnore public class MediaType extends Object implements Comparable<MediaType>
Modifier and Type | Field and Description |
---|---|
static MediaType |
CSV
Reusable predefined media type
|
static MediaType |
HTML
Reusable predefined media type
|
static MediaType |
JSON
Reusable predefined media type
|
static MediaType |
MSGPACK
Reusable predefined media type
|
static MediaType |
N3
Reusable predefined media type
|
static MediaType |
NTRIPLE
Reusable predefined media type
|
static MediaType |
PLAIN
Reusable predefined media type
|
static MediaType |
RDF
Reusable predefined media type
|
static MediaType |
RDFABBREV
Reusable predefined media type
|
static MediaType |
TURTLE
Reusable predefined media type
|
static MediaType |
UON
Reusable predefined media type
|
static MediaType |
URLENCODING
Reusable predefined media type
|
static MediaType |
XML
Reusable predefined media type
|
static MediaType |
XMLSOAP
Reusable predefined media type
|
Constructor and Description |
---|
MediaType(HeaderElement e)
Constructor.
|
MediaType(String mt)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(MediaType o) |
boolean |
equals(Object o) |
String |
getParameter(String name)
Returns the additional parameter on this media type.
|
List<NameValuePair> |
getParameters()
Returns the additional parameters on this media type.
|
String |
getSubType()
Returns the
|
List<String> |
getSubTypes()
Returns the subtypes broken down by fragments delimited by
|
String |
getType()
Returns the
|
int |
hashCode() |
boolean |
hasSubType(String st)
Returns
|
boolean |
isMetaSubtype()
Returns
|
int |
match(MediaType o,
boolean allowExtraSubTypes)
Returns a match metric against the specified media type where a larger number represents a better match.
|
static MediaType |
of(String value)
Returns the media type for the specified string.
|
static MediaType[] |
ofAll(String... values)
Same as
of(String) but allows you to construct an array of |
String |
toString() |
public static final MediaType URLENCODING
public MediaType(HeaderElement e)
e
- The parsed media type string.public static MediaType of(String value)
value
- The media type string.
Will be lowercased.
Returns public static MediaType[] ofAll(String... values)
of(String)
but allows you to construct an array of values
- The media type strings.public final String getType()
public final String getSubType()
public final boolean hasSubType(String st)
st
- The subtype string.
Case is ignored.public final List<String> getSubTypes()
For example, the media type [
public final boolean isMetaSubtype()
public final int match(MediaType o, boolean allowExtraSubTypes)
This media type can contain
The comparison media type must not.
JsonSerializer
(SimpleJsonSerializer
(o
- The media type to compare with.allowExtraSubTypes
- If public List<NameValuePair> getParameters()
For example, given the media type string {level:[
.
public String getParameter(String name)
name
- The additional parameter name.public final int compareTo(MediaType o)
compareTo
in interface Comparable<MediaType>
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.