@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
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(MediaType o) |
boolean |
equals(Object o) |
static MediaType |
forString(String s)
Returns the media type for the specified string.
|
static MediaType[] |
forStrings(String... s)
Same as
forString(String) but allows you to construct an array of MediaTypes from an
array of strings. |
Map<String,Set<String>> |
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 |
isMeta()
Returns
|
int |
match(MediaType o,
boolean allowExtraSubTypes)
Returns a match metric against the specified media type where a larger number represents a better match.
|
String |
toString() |
public static final MediaType URLENCODING
public static MediaType forString(String s)
s
- The media type string.
Will be lowercased.
Returns public static MediaType[] forStrings(String... s)
forString(String)
but allows you to construct an array of MediaTypes
from an
array of strings.s
- The media type strings.MediaType
objects.
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 isMeta()
public final int match(MediaType o, boolean allowExtraSubTypes)
This media type can contain
The comparison media type must not.
allowExtraSubTypes
flag is set.
The reverse is not true, e.g. the comparison media type must contain all subtype tokens found in the
comparing media type.
JsonSerializer
(JsonSerializer.Simple
(type/subTypes
:
100,000
.
10,000
for an exact match (e.g. 5,000
for a meta match (e.g. 7,500
for an exact match (e.g. 100
for every subtype entry match (e.g. o
- The media type to compare with.allowExtraSubTypes
- If public final Map<String,Set<String>> getParameters()
For example, given the media type string {level:[
.
public final int compareTo(MediaType o)
compareTo
in interface Comparable<MediaType>
Copyright © 2018 Apache. All rights reserved.