|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.jersey.message.internal.MediaTypes
public class MediaTypes
Common media types and functionality.
| Field Summary | |
|---|---|
static MediaType |
FAST_INFOSET
Fast infoset media type. |
static MediaType |
GENERAL_MEDIA_TYPE
The general media type corresponding to \*\/*. |
static List<MediaType> |
GENERAL_MEDIA_TYPE_LIST
A singleton list containing the general media type. |
static List<MediaType> |
GENERAL_QUALITY_SOURCE_MEDIA_TYPE_LIST
A singleton list containing the general media type. |
static Comparator<MediaType> |
MEDIA_TYPE_COMPARATOR
Comparator for media types. |
static Comparator<List<? extends MediaType>> |
MEDIA_TYPE_LIST_COMPARATOR
Comparator for lists of media types. |
static Comparator<QualitySourceMediaType> |
QUALITY_SOURCE_MEDIA_TYPE_COMPARATOR
Comparator for lists of quality source media types. |
static MediaType |
WADL
WADL Media type. |
| Method Summary | |
|---|---|
static List<MediaType> |
createFrom(Consumes annotation)
Create the list of media types from the values declared in the Consumes
annotation. |
static List<MediaType> |
createFrom(Produces annotation)
Create the list of media types from the values declared in the Produces
annotation. |
static List<MediaType> |
createFrom(String[] mediaTypes)
Create a list of media type from a string array of media types. |
static List<MediaType> |
createQualitySourceMediaTypes(Produces mime)
Create a list of quality source media type from the Produces annotation. |
static List<QualitySourceMediaType> |
createQualitySourceMediaTypes(String[] mediaTypes)
Create a list of quality source media type from an array of media types. |
static int |
getQuality(MediaType mt)
Reads quality factor from given media type. |
static MediaType |
getTypeWildCart(MediaType mediaType)
Returns MediaType with wildcard in subtype. |
static boolean |
intersect(List<? extends MediaType> ml1,
List<? extends MediaType> ml2)
Determine if the two list of media types share a common type-equal
sub-list. |
static MediaType |
mostSpecific(MediaType m1,
MediaType m2)
Get the most specific media type from a pair of media types. |
static MediaType |
stripQualityParams(MediaType mediaType)
Strips any quality parameters, i.e. |
static boolean |
typeEqual(MediaType m1,
MediaType m2)
Determine if the two media types are type-equal (their type
and subtype are equal). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final MediaType WADL
public static final MediaType FAST_INFOSET
public static final Comparator<List<? extends MediaType>> MEDIA_TYPE_LIST_COMPARATOR
The least specific content type of each list is obtained and then compared
using MEDIA_TYPE_COMPARATOR.
Assumes each list is already ordered according to MEDIA_TYPE_COMPARATOR
and therefore the least specific media type is at the end of the list.
public static final MediaType GENERAL_MEDIA_TYPE
public static final List<MediaType> GENERAL_MEDIA_TYPE_LIST
public static final List<MediaType> GENERAL_QUALITY_SOURCE_MEDIA_TYPE_LIST
public static final Comparator<QualitySourceMediaType> QUALITY_SOURCE_MEDIA_TYPE_COMPARATOR
public static final Comparator<MediaType> MEDIA_TYPE_COMPARATOR
m/n < m/* < */*The actual media type values are ignored, i.e. the different media types are considered equal if they are comparably specific:
compare(m/n, x/y) == 0 compare(m/*, x/*) == 0
| Method Detail |
|---|
public static boolean typeEqual(MediaType m1,
MediaType m2)
type
and subtype are equal). For example:
m/n == m/n m/n;p1 == m/n;p2 m/n != m/y m/n != x/n m/n != x/y
m1 - first media type.m2 - second media type.
true if the two media types are of the same type and subtype,
false otherwise.
public static boolean intersect(List<? extends MediaType> ml1,
List<? extends MediaType> ml2)
type-equal
sub-list.
ml1 - first media type list.ml2 - second media type list.
true if the two media type lists intersect by sharing a
common type-equal sub-list, false otherwise.
public static MediaType mostSpecific(MediaType m1,
MediaType m2)
m1 - the first media typem2 - the second media type
public static List<MediaType> createFrom(Consumes annotation)
Consumes
annotation.
annotation - the Consumes annotation.
MediaType, ordered according to MEDIA_TYPE_COMPARATOR.public static List<MediaType> createFrom(Produces annotation)
Produces
annotation.
annotation - the Produces annotation.
MediaType, ordered according to MEDIA_TYPE_COMPARATOR.public static List<MediaType> createFrom(String[] mediaTypes)
mediaTypes - the string array of media types.
MediaType, ordered according to MEDIA_TYPE_COMPARATOR.public static List<MediaType> createQualitySourceMediaTypes(Produces mime)
mime - the Produces annotation.
QualitySourceMediaType, ordered according to
QUALITY_SOURCE_MEDIA_TYPE_COMPARATOR.public static List<QualitySourceMediaType> createQualitySourceMediaTypes(String[] mediaTypes)
mediaTypes - the array of media types.
QualitySourceMediaType, ordered according to
the quality source as the primary key and MEDIA_TYPE_COMPARATOR
as the secondary key.public static int getQuality(MediaType mt)
mt - media type to read quality parameter from
public static MediaType stripQualityParams(MediaType mediaType)
mediaType - type to strip quality parameters from
public static MediaType getTypeWildCart(MediaType mediaType)
mediaType - original MediaType.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||