org.restlet.data
Class MediaType

java.lang.Object
  extended by org.restlet.data.Metadata
      extended by org.restlet.data.MediaType

public final class MediaType
extends Metadata

Media type used in representations and preferences. The Metadata.getName() method returns a full String representation of the media type including the parameters.

Author:
Jerome Louvel
See Also:
MIME types on Wikipedia

Field Summary
static MediaType ALL
           
static MediaType APPLICATION_ALL
           
static MediaType APPLICATION_ALL_XML
           
static MediaType APPLICATION_ATOM
           
static MediaType APPLICATION_ATOM_SERVICE_XML
          Deprecated. Use APPLICATION_ATOMPUB_SERVICE instead.
static MediaType APPLICATION_ATOM_XML
          Deprecated. Use APPLICATION_ATOMPUB_SERVICE instead.
static MediaType APPLICATION_ATOMPUB_CATEGORY
           
static MediaType APPLICATION_ATOMPUB_SERVICE
           
static MediaType APPLICATION_CAB
           
static MediaType APPLICATION_COMPRESS
           
static MediaType APPLICATION_EXCEL
           
static MediaType APPLICATION_FLASH
           
static MediaType APPLICATION_GNU_TAR
           
static MediaType APPLICATION_GNU_ZIP
           
static MediaType APPLICATION_HTTP_COOKIES
           
static MediaType APPLICATION_JAVA
           
static MediaType APPLICATION_JAVA_ARCHIVE
           
static MediaType APPLICATION_JAVA_OBJECT
           
static MediaType APPLICATION_JAVA_OBJECT_GWT
           
static MediaType APPLICATION_JAVA_OBJECT_XML
           
static MediaType APPLICATION_JAVASCRIPT
           
static MediaType APPLICATION_JNLP
           
static MediaType APPLICATION_JSON
           
static MediaType APPLICATION_KML
           
static MediaType APPLICATION_KMZ
           
static MediaType APPLICATION_LATEX
           
static MediaType APPLICATION_MAC_BINHEX40
           
static MediaType APPLICATION_MATHML
           
static MediaType APPLICATION_MATHML_XML
          Deprecated. Use APPLICATION_MATHML instead.
static MediaType APPLICATION_MSOFFICE_DOCM
           
static MediaType APPLICATION_MSOFFICE_DOCX
           
static MediaType APPLICATION_MSOFFICE_DOTM
           
static MediaType APPLICATION_MSOFFICE_DOTX
           
static MediaType APPLICATION_MSOFFICE_ONETOC
           
static MediaType APPLICATION_MSOFFICE_ONETOC2
           
static MediaType APPLICATION_MSOFFICE_POTM
           
static MediaType APPLICATION_MSOFFICE_POTX
           
static MediaType APPLICATION_MSOFFICE_PPAM
           
static MediaType APPLICATION_MSOFFICE_PPSM
           
static MediaType APPLICATION_MSOFFICE_PPSX
           
static MediaType APPLICATION_MSOFFICE_PPTM
           
static MediaType APPLICATION_MSOFFICE_PPTX
           
static MediaType APPLICATION_MSOFFICE_SLDM
           
static MediaType APPLICATION_MSOFFICE_SLDX
           
static MediaType APPLICATION_MSOFFICE_XLAM
           
static MediaType APPLICATION_MSOFFICE_XLSB
           
static MediaType APPLICATION_MSOFFICE_XLSM
           
static MediaType APPLICATION_MSOFFICE_XLSX
           
static MediaType APPLICATION_MSOFFICE_XLTM
           
static MediaType APPLICATION_MSOFFICE_XLTX
           
static MediaType APPLICATION_OCTET_STREAM
           
static MediaType APPLICATION_OPENOFFICE_ODB
           
static MediaType APPLICATION_OPENOFFICE_ODC
           
static MediaType APPLICATION_OPENOFFICE_ODF
           
static MediaType APPLICATION_OPENOFFICE_ODG
           
static MediaType APPLICATION_OPENOFFICE_ODI
           
static MediaType APPLICATION_OPENOFFICE_ODM
           
static MediaType APPLICATION_OPENOFFICE_ODP
           
static MediaType APPLICATION_OPENOFFICE_ODS
           
static MediaType APPLICATION_OPENOFFICE_ODT
           
static MediaType APPLICATION_OPENOFFICE_OTG
           
static MediaType APPLICATION_OPENOFFICE_OTH
           
static MediaType APPLICATION_OPENOFFICE_OTP
           
static MediaType APPLICATION_OPENOFFICE_OTS
           
static MediaType APPLICATION_OPENOFFICE_OTT
           
static MediaType APPLICATION_OPENOFFICE_OXT
           
static MediaType APPLICATION_PDF
           
static MediaType APPLICATION_POSTSCRIPT
           
static MediaType APPLICATION_POWERPOINT
           
static MediaType APPLICATION_PROJECT
           
static MediaType APPLICATION_RDF_TRIG
           
static MediaType APPLICATION_RDF_TRIX
           
static MediaType APPLICATION_RDF_TURTLE
           
static MediaType APPLICATION_RDF_XML
           
static MediaType APPLICATION_RELAXNG_COMPACT
           
static MediaType APPLICATION_RELAXNG_XML
           
static MediaType APPLICATION_RSS
           
static MediaType APPLICATION_RSS_XML
          Deprecated. Use APPLICATION_RSS instead.
static MediaType APPLICATION_RTF
           
static MediaType APPLICATION_SPARQL_RESULTS_JSON
           
static MediaType APPLICATION_SPARQL_RESULTS_XML
           
static MediaType APPLICATION_SPSS_SAV
           
static MediaType APPLICATION_SPSS_SPS
           
static MediaType APPLICATION_STATA_STA
           
static MediaType APPLICATION_STUFFIT
           
static MediaType APPLICATION_TAR
           
static MediaType APPLICATION_TEX
           
static MediaType APPLICATION_TROFF_MAN
           
static MediaType APPLICATION_VOICEXML
           
static MediaType APPLICATION_W3C_SCHEMA
           
static MediaType APPLICATION_W3C_SCHEMA_XML
          Deprecated. Use APPLICATION_W3C_SCHEMA instead.
static MediaType APPLICATION_W3C_XSLT
           
static MediaType APPLICATION_WADL
           
static MediaType APPLICATION_WADL_XML
          Deprecated. Use APPLICATION_WADL instead.
static MediaType APPLICATION_WORD
           
static MediaType APPLICATION_WWW_FORM
           
static MediaType APPLICATION_XHTML
           
static MediaType APPLICATION_XHTML_XML
          Deprecated. Use APPLICATION_XHTML instead.
static MediaType APPLICATION_XMI_XML
           
static MediaType APPLICATION_XML
           
static MediaType APPLICATION_XML_DTD
           
static MediaType APPLICATION_XUL
           
static MediaType APPLICATION_ZIP
           
static MediaType AUDIO_ALL
           
static MediaType AUDIO_BASIC
           
static MediaType AUDIO_MIDI
           
static MediaType AUDIO_MPEG
           
static MediaType AUDIO_REAL
           
static MediaType AUDIO_WAV
           
static MediaType IMAGE_ALL
           
static MediaType IMAGE_BMP
           
static MediaType IMAGE_GIF
           
static MediaType IMAGE_ICON
           
static MediaType IMAGE_JPEG
           
static MediaType IMAGE_PNG
           
static MediaType IMAGE_SVG
           
static MediaType IMAGE_TIFF
           
static MediaType MESSAGE_ALL
           
static MediaType MODEL_ALL
           
static MediaType MODEL_VRML
           
static MediaType MULTIPART_ALL
           
static MediaType MULTIPART_FORM_DATA
           
static MediaType TEXT_ALL
           
static MediaType TEXT_CALENDAR
           
static MediaType TEXT_CSS
           
static MediaType TEXT_CSV
           
static MediaType TEXT_DAT
           
static MediaType TEXT_HTML
           
static MediaType TEXT_J2ME_APP_DESCRIPTOR
           
static MediaType TEXT_JAVASCRIPT
           
static MediaType TEXT_PLAIN
           
static MediaType TEXT_RDF_N3
           
static MediaType TEXT_RDF_NTRIPLES
           
static MediaType TEXT_TSV
           
static MediaType TEXT_URI_LIST
           
static MediaType TEXT_VCARD
           
static MediaType TEXT_XML
           
static MediaType VIDEO_ALL
           
static MediaType VIDEO_AVI
           
static MediaType VIDEO_MP4
           
static MediaType VIDEO_MPEG
           
static MediaType VIDEO_QUICKTIME
           
static MediaType VIDEO_WMV
           
 
Constructor Summary
MediaType(String name)
          Constructor.
MediaType(String name, Series<Parameter> parameters)
          Constructor.
MediaType(String name, Series<Parameter> parameters, String description)
          Constructor.
MediaType(String name, String description)
          Constructor.
 
Method Summary
 boolean equals(Object obj)
          
 boolean equals(Object obj, boolean ignoreParameters)
          Test the equality of two media types, with the possibility to ignore the parameters.
 String getMainType()
          Returns the main type.
static MediaType getMostSpecific(MediaType... mediaTypes)
          Returns the first of the most specific media type of the given array of MediaTypes.
 Series<Parameter> getParameters()
          Returns the unmodifiable list of parameters.
 MediaType getParent()
          Returns the parent metadata if available or null.
 String getSubType()
          Returns the sub-type.
 int hashCode()
          
 boolean includes(Metadata included)
          Indicates if a given media type is included in the current one.
 boolean isConcrete()
          Checks if the current media type is concrete.
static MediaType register(String name, String description)
          Register a media type as a known type that can later be retrieved using valueOf(String).
 String toString()
          Returns the metadata name.
static MediaType valueOf(String name)
          Returns the media type associated to a name.
 
Methods inherited from class org.restlet.data.Metadata
getDescription, getName, isCompatible
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ALL

public static final MediaType ALL

APPLICATION_ALL

public static final MediaType APPLICATION_ALL

APPLICATION_ALL_XML

public static final MediaType APPLICATION_ALL_XML

APPLICATION_ATOM

public static final MediaType APPLICATION_ATOM

APPLICATION_ATOM_SERVICE_XML

@Deprecated
public static final MediaType APPLICATION_ATOM_SERVICE_XML
Deprecated. Use APPLICATION_ATOMPUB_SERVICE instead.

APPLICATION_ATOM_XML

@Deprecated
public static final MediaType APPLICATION_ATOM_XML
Deprecated. Use APPLICATION_ATOMPUB_SERVICE instead.

APPLICATION_ATOMPUB_CATEGORY

public static final MediaType APPLICATION_ATOMPUB_CATEGORY

APPLICATION_ATOMPUB_SERVICE

public static final MediaType APPLICATION_ATOMPUB_SERVICE

APPLICATION_CAB

public static final MediaType APPLICATION_CAB

APPLICATION_COMPRESS

public static final MediaType APPLICATION_COMPRESS

APPLICATION_EXCEL

public static final MediaType APPLICATION_EXCEL

APPLICATION_FLASH

public static final MediaType APPLICATION_FLASH

APPLICATION_GNU_TAR

public static final MediaType APPLICATION_GNU_TAR

APPLICATION_GNU_ZIP

public static final MediaType APPLICATION_GNU_ZIP

APPLICATION_HTTP_COOKIES

public static final MediaType APPLICATION_HTTP_COOKIES

APPLICATION_JAVA

public static final MediaType APPLICATION_JAVA

APPLICATION_JAVA_ARCHIVE

public static final MediaType APPLICATION_JAVA_ARCHIVE

APPLICATION_JAVA_OBJECT

public static final MediaType APPLICATION_JAVA_OBJECT

APPLICATION_JAVA_OBJECT_GWT

public static final MediaType APPLICATION_JAVA_OBJECT_GWT

APPLICATION_JAVA_OBJECT_XML

public static final MediaType APPLICATION_JAVA_OBJECT_XML

APPLICATION_JAVASCRIPT

public static final MediaType APPLICATION_JAVASCRIPT

APPLICATION_JNLP

public static final MediaType APPLICATION_JNLP

APPLICATION_JSON

public static final MediaType APPLICATION_JSON

APPLICATION_KML

public static final MediaType APPLICATION_KML

APPLICATION_KMZ

public static final MediaType APPLICATION_KMZ

APPLICATION_LATEX

public static final MediaType APPLICATION_LATEX

APPLICATION_MAC_BINHEX40

public static final MediaType APPLICATION_MAC_BINHEX40

APPLICATION_MATHML

public static final MediaType APPLICATION_MATHML

APPLICATION_MATHML_XML

@Deprecated
public static final MediaType APPLICATION_MATHML_XML
Deprecated. Use APPLICATION_MATHML instead.

APPLICATION_MSOFFICE_DOCM

public static final MediaType APPLICATION_MSOFFICE_DOCM

APPLICATION_MSOFFICE_DOCX

public static final MediaType APPLICATION_MSOFFICE_DOCX

APPLICATION_MSOFFICE_DOTM

public static final MediaType APPLICATION_MSOFFICE_DOTM

APPLICATION_MSOFFICE_DOTX

public static final MediaType APPLICATION_MSOFFICE_DOTX

APPLICATION_MSOFFICE_ONETOC

public static final MediaType APPLICATION_MSOFFICE_ONETOC

APPLICATION_MSOFFICE_ONETOC2

public static final MediaType APPLICATION_MSOFFICE_ONETOC2

APPLICATION_MSOFFICE_POTM

public static final MediaType APPLICATION_MSOFFICE_POTM

APPLICATION_MSOFFICE_POTX

public static final MediaType APPLICATION_MSOFFICE_POTX

APPLICATION_MSOFFICE_PPAM

public static final MediaType APPLICATION_MSOFFICE_PPAM

APPLICATION_MSOFFICE_PPSM

public static final MediaType APPLICATION_MSOFFICE_PPSM

APPLICATION_MSOFFICE_PPSX

public static final MediaType APPLICATION_MSOFFICE_PPSX

APPLICATION_MSOFFICE_PPTM

public static final MediaType APPLICATION_MSOFFICE_PPTM

APPLICATION_MSOFFICE_PPTX

public static final MediaType APPLICATION_MSOFFICE_PPTX

APPLICATION_MSOFFICE_SLDM

public static final MediaType APPLICATION_MSOFFICE_SLDM

APPLICATION_MSOFFICE_SLDX

public static final MediaType APPLICATION_MSOFFICE_SLDX

APPLICATION_MSOFFICE_XLAM

public static final MediaType APPLICATION_MSOFFICE_XLAM

APPLICATION_MSOFFICE_XLSB

public static final MediaType APPLICATION_MSOFFICE_XLSB

APPLICATION_MSOFFICE_XLSM

public static final MediaType APPLICATION_MSOFFICE_XLSM

APPLICATION_MSOFFICE_XLSX

public static final MediaType APPLICATION_MSOFFICE_XLSX

APPLICATION_MSOFFICE_XLTM

public static final MediaType APPLICATION_MSOFFICE_XLTM

APPLICATION_MSOFFICE_XLTX

public static final MediaType APPLICATION_MSOFFICE_XLTX

APPLICATION_OCTET_STREAM

public static final MediaType APPLICATION_OCTET_STREAM

APPLICATION_OPENOFFICE_ODB

public static final MediaType APPLICATION_OPENOFFICE_ODB

APPLICATION_OPENOFFICE_ODC

public static final MediaType APPLICATION_OPENOFFICE_ODC

APPLICATION_OPENOFFICE_ODF

public static final MediaType APPLICATION_OPENOFFICE_ODF

APPLICATION_OPENOFFICE_ODG

public static final MediaType APPLICATION_OPENOFFICE_ODG

APPLICATION_OPENOFFICE_ODI

public static final MediaType APPLICATION_OPENOFFICE_ODI

APPLICATION_OPENOFFICE_ODM

public static final MediaType APPLICATION_OPENOFFICE_ODM

APPLICATION_OPENOFFICE_ODP

public static final MediaType APPLICATION_OPENOFFICE_ODP

APPLICATION_OPENOFFICE_ODS

public static final MediaType APPLICATION_OPENOFFICE_ODS

APPLICATION_OPENOFFICE_ODT

public static final MediaType APPLICATION_OPENOFFICE_ODT

APPLICATION_OPENOFFICE_OTG

public static final MediaType APPLICATION_OPENOFFICE_OTG

APPLICATION_OPENOFFICE_OTH

public static final MediaType APPLICATION_OPENOFFICE_OTH

APPLICATION_OPENOFFICE_OTP

public static final MediaType APPLICATION_OPENOFFICE_OTP

APPLICATION_OPENOFFICE_OTS

public static final MediaType APPLICATION_OPENOFFICE_OTS

APPLICATION_OPENOFFICE_OTT

public static final MediaType APPLICATION_OPENOFFICE_OTT

APPLICATION_OPENOFFICE_OXT

public static final MediaType APPLICATION_OPENOFFICE_OXT

APPLICATION_PDF

public static final MediaType APPLICATION_PDF

APPLICATION_POSTSCRIPT

public static final MediaType APPLICATION_POSTSCRIPT

APPLICATION_POWERPOINT

public static final MediaType APPLICATION_POWERPOINT

APPLICATION_PROJECT

public static final MediaType APPLICATION_PROJECT

APPLICATION_RDF_TRIG

public static final MediaType APPLICATION_RDF_TRIG

APPLICATION_RDF_TRIX

public static final MediaType APPLICATION_RDF_TRIX

APPLICATION_RDF_TURTLE

public static final MediaType APPLICATION_RDF_TURTLE

APPLICATION_RDF_XML

public static final MediaType APPLICATION_RDF_XML

APPLICATION_RELAXNG_COMPACT

public static final MediaType APPLICATION_RELAXNG_COMPACT

APPLICATION_RELAXNG_XML

public static final MediaType APPLICATION_RELAXNG_XML

APPLICATION_RSS

public static final MediaType APPLICATION_RSS

APPLICATION_RSS_XML

@Deprecated
public static final MediaType APPLICATION_RSS_XML
Deprecated. Use APPLICATION_RSS instead.

APPLICATION_RTF

public static final MediaType APPLICATION_RTF

APPLICATION_SPARQL_RESULTS_JSON

public static final MediaType APPLICATION_SPARQL_RESULTS_JSON

APPLICATION_SPARQL_RESULTS_XML

public static final MediaType APPLICATION_SPARQL_RESULTS_XML

APPLICATION_SPSS_SAV

public static final MediaType APPLICATION_SPSS_SAV

APPLICATION_SPSS_SPS

public static final MediaType APPLICATION_SPSS_SPS

APPLICATION_STATA_STA

public static final MediaType APPLICATION_STATA_STA

APPLICATION_STUFFIT

public static final MediaType APPLICATION_STUFFIT

APPLICATION_TAR

public static final MediaType APPLICATION_TAR

APPLICATION_TEX

public static final MediaType APPLICATION_TEX

APPLICATION_TROFF_MAN

public static final MediaType APPLICATION_TROFF_MAN

APPLICATION_VOICEXML

public static final MediaType APPLICATION_VOICEXML

APPLICATION_W3C_SCHEMA

public static final MediaType APPLICATION_W3C_SCHEMA

APPLICATION_W3C_SCHEMA_XML

@Deprecated
public static final MediaType APPLICATION_W3C_SCHEMA_XML
Deprecated. Use APPLICATION_W3C_SCHEMA instead.

APPLICATION_W3C_XSLT

public static final MediaType APPLICATION_W3C_XSLT

APPLICATION_WADL

public static final MediaType APPLICATION_WADL

APPLICATION_WADL_XML

@Deprecated
public static final MediaType APPLICATION_WADL_XML
Deprecated. Use APPLICATION_WADL instead.

APPLICATION_WORD

public static final MediaType APPLICATION_WORD

APPLICATION_WWW_FORM

public static final MediaType APPLICATION_WWW_FORM

APPLICATION_XHTML

public static final MediaType APPLICATION_XHTML

APPLICATION_XHTML_XML

@Deprecated
public static final MediaType APPLICATION_XHTML_XML
Deprecated. Use APPLICATION_XHTML instead.

APPLICATION_XMI_XML

public static final MediaType APPLICATION_XMI_XML

APPLICATION_XML

public static final MediaType APPLICATION_XML

APPLICATION_XML_DTD

public static final MediaType APPLICATION_XML_DTD

APPLICATION_XUL

public static final MediaType APPLICATION_XUL

APPLICATION_ZIP

public static final MediaType APPLICATION_ZIP

AUDIO_ALL

public static final MediaType AUDIO_ALL

AUDIO_BASIC

public static final MediaType AUDIO_BASIC

AUDIO_MIDI

public static final MediaType AUDIO_MIDI

AUDIO_MPEG

public static final MediaType AUDIO_MPEG

AUDIO_REAL

public static final MediaType AUDIO_REAL

AUDIO_WAV

public static final MediaType AUDIO_WAV

IMAGE_ALL

public static final MediaType IMAGE_ALL

IMAGE_BMP

public static final MediaType IMAGE_BMP

IMAGE_GIF

public static final MediaType IMAGE_GIF

IMAGE_ICON

public static final MediaType IMAGE_ICON

IMAGE_JPEG

public static final MediaType IMAGE_JPEG

IMAGE_PNG

public static final MediaType IMAGE_PNG

IMAGE_SVG

public static final MediaType IMAGE_SVG

IMAGE_TIFF

public static final MediaType IMAGE_TIFF

MESSAGE_ALL

public static final MediaType MESSAGE_ALL

MODEL_ALL

public static final MediaType MODEL_ALL

MODEL_VRML

public static final MediaType MODEL_VRML

MULTIPART_ALL

public static final MediaType MULTIPART_ALL

MULTIPART_FORM_DATA

public static final MediaType MULTIPART_FORM_DATA

TEXT_ALL

public static final MediaType TEXT_ALL

TEXT_CALENDAR

public static final MediaType TEXT_CALENDAR

TEXT_CSS

public static final MediaType TEXT_CSS

TEXT_CSV

public static final MediaType TEXT_CSV

TEXT_DAT

public static final MediaType TEXT_DAT

TEXT_HTML

public static final MediaType TEXT_HTML

TEXT_J2ME_APP_DESCRIPTOR

public static final MediaType TEXT_J2ME_APP_DESCRIPTOR

TEXT_JAVASCRIPT

public static final MediaType TEXT_JAVASCRIPT

TEXT_PLAIN

public static final MediaType TEXT_PLAIN

TEXT_RDF_N3

public static final MediaType TEXT_RDF_N3

TEXT_RDF_NTRIPLES

public static final MediaType TEXT_RDF_NTRIPLES

TEXT_TSV

public static final MediaType TEXT_TSV

TEXT_URI_LIST

public static final MediaType TEXT_URI_LIST

TEXT_VCARD

public static final MediaType TEXT_VCARD

TEXT_XML

public static final MediaType TEXT_XML

VIDEO_ALL

public static final MediaType VIDEO_ALL

VIDEO_AVI

public static final MediaType VIDEO_AVI

VIDEO_MP4

public static final MediaType VIDEO_MP4

VIDEO_MPEG

public static final MediaType VIDEO_MPEG

VIDEO_QUICKTIME

public static final MediaType VIDEO_QUICKTIME

VIDEO_WMV

public static final MediaType VIDEO_WMV
Constructor Detail

MediaType

public MediaType(String name)
Constructor.

Parameters:
name - The name.

MediaType

public MediaType(String name,
                 Series<Parameter> parameters)
Constructor.

Parameters:
name - The name.
parameters - The list of parameters.

MediaType

public MediaType(String name,
                 Series<Parameter> parameters,
                 String description)
Constructor.

Parameters:
name - The name.
parameters - The list of parameters.
description - The description.

MediaType

public MediaType(String name,
                 String description)
Constructor.

Parameters:
name - The name.
description - The description.
Method Detail

getMostSpecific

public static MediaType getMostSpecific(MediaType... mediaTypes)
                                 throws IllegalArgumentException
Returns the first of the most specific media type of the given array of MediaTypes.

Examples:

Parameters:
mediaTypes - An array of media types.
Returns:
The most concrete MediaType.
Throws:
IllegalArgumentException - If the array is null or empty.

register

public static MediaType register(String name,
                                 String description)
Register a media type as a known type that can later be retrieved using valueOf(String). If the type already exists, the existing type is returned, otherwise a new instance is created.

Parameters:
name - The name.
description - The description.
Returns:
The registered media type

valueOf

public static MediaType valueOf(String name)
Returns the media type associated to a name. If an existing constant exists then it is returned, otherwise a new instance is created.

Parameters:
name - The name.
Returns:
The associated media type.

equals

public boolean equals(Object obj)

Overrides:
equals in class Metadata

equals

public boolean equals(Object obj,
                      boolean ignoreParameters)
Test the equality of two media types, with the possibility to ignore the parameters.

Parameters:
obj - The object to compare to.
ignoreParameters - Indicates if parameters should be ignored during comparison.
Returns:
True if both media types are equal.

getMainType

public String getMainType()
Returns the main type.

Returns:
The main type.

getParameters

public Series<Parameter> getParameters()
Returns the unmodifiable list of parameters. Creates a new instance if no one has been set.

Returns:
The list of parameters.

getParent

public MediaType getParent()
Returns the parent metadata if available or null.
In case the media type has parameters, this method returns the concatenation of the main type and the subtype. If the subtype is not equal to "*", it returns the concatenation of the main type and "*". Otherwise, it returns either the ALL media type if it is already the ALL media type, or null.

Specified by:
getParent in class Metadata
Returns:
The parent metadata.

getSubType

public String getSubType()
Returns the sub-type.

Returns:
The sub-type.

hashCode

public int hashCode()

Overrides:
hashCode in class Metadata

includes

public boolean includes(Metadata included)
Indicates if a given media type is included in the current one. The test is true if both types are equal or if the given media type is within the range of the current one. For example, ALL includes all media types. Parameters are ignored for this comparison. A null media type is considered as included into the current one.

Examples:

Specified by:
includes in class Metadata
Parameters:
included - The media type to test for inclusion.
Returns:
True if the given media type is included in the current one.
See Also:
Metadata.isCompatible(Metadata)

isConcrete

public boolean isConcrete()
Checks if the current media type is concrete. A media type is concrete if neither the main type nor the sub-type are equal to "*".

Returns:
True if this media type is concrete.

toString

public String toString()
Description copied from class: Metadata
Returns the metadata name.

Overrides:
toString in class Metadata
Returns:
The metadata name.


Copyright © 2005-2013 Restlet S.A.S..