Package io.micronaut.http
Class MediaType
java.lang.Object
io.micronaut.http.MediaType
- All Implemented Interfaces:
CharSequence
Represents a media type.
See https://www.iana.org/assignments/media-types/media-types.xhtml and https://tools.ietf.org/html/rfc2046
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringA wildcard media type representing all types.static final MediaTypeA wildcard media type representing all types.static final StringAtom: application/atom+xml.static final MediaTypeAtom: application/atom+xml.static final StringCUE format data: application/x-cue.static final StringForm encoded data: application/x-www-form-urlencoded.static final MediaTypeForm encoded data: application/x-www-form-urlencoded.static final StringGPS Exchange Format: application/gpx+xml.static final StringGraphQL: application/graphql.static final MediaTypeGraphQL: application/graphql.static final StringGZip compressed data: application/gzip.static final StringHAL JSON: application/hal+json.static final MediaTypeHAL JSON: application/hal+json.static final StringHAL XML: application/hal+xml.static final MediaTypeHAL XML: application/hal+xml.static final StringJSON: application/json.static final StringJSON Feed: application/feed+json.static final MediaTypeJSON Feed: application/feed+json.static final StringJSON GitHub: application/vnd.github+json.static final MediaTypeJSON GitHub: application/vnd.github+json.static final Stringstatic final MediaTypeJSON Merge Patch: application/merge-patch+json.static final Stringstatic final MediaTypeJSON Patch: application/json-patch+json.static final StringJSON Feed: application/problem+json.static final MediaTypeJSON Feed: application/problem+json.static final StringJSON Schema: application/schema+json.static final MediaTypeJSON Schema: application/schema+json.static final StringJSON Stream: application/x-json-stream.static final MediaTypeJSON Stream: application/x-json-stream.static final MediaTypeJSON: application/json.static final StringBINARY: application/octet-stream.static final MediaTypeBINARY: application/octet-stream.static final StringPDF: application/pdf.static final MediaTypePDF: application/pdf.static final StringRTF format data: application/rtf.static final StringTOML format data: application/toml.static final StringVND Error: application/vnd.error+json.static final MediaTypeVND Error: application/vnd.error+json.static final StringXHTML: application/xhtml+xml.static final MediaTypeXHTML: application/xhtml+xml.static final StringXML: application/xml.static final MediaTypeXML: application/xml.static final StringYAML: application/x-yaml.static final MediaTypeYAML: application/x-yaml.static final StringYANG format data: application/yang.static final StringZIP archive format: application/zip.static final StringZlib compressed data: application/zlib.static final StringZstd compressed data: application/zstd.static final StringParameter"charset".static final MediaTypeCUE format data: application/x-cue.static final MediaType[]Default empty media type array.protected final Stringstatic final StringFile extension for Microsoft Word document files in use between 97-2003.static final StringFile extension used for Microsoft Word Open XML document (DOCX).static final StringFile extension for GPS Exchange Format files.static final StringFile extension for GZIP compressed files.static final StringDefault file extension used for JSON.static final StringFile extension for OpenDocument presentation files.static final StringFile extension for OpenDocument spreadsheets.static final StringFile extension for OpenDocument text files.static final StringDefault file extension used for PDF.static final StringFile extension for Microsoft Powerpoint files in use between 97-2003.static final StringFile extension used for Microsoft Powerpoint Open XML document (PPTX).static final StringFile extension for Microsoft Excel's workbook files in use between 97-2003.static final StringFile extension used for Microsoft Excel Open XML Spreadsheet (XLSX).static final StringDefault file extension used for XML.static final StringFile extension for ZIP archive files.static final MediaTypeShortcut forAPPLICATION_FORM_URLENCODED_TYPE.static final MediaTypeGPS Exchange Format: application/gpx+xml.static final MediaTypeGZip compressed data: application/gzip.static final StringAnimated Portable Network Graphics (APNG): image/apng.static final MediaTypeAnimated Portable Network Graphics (APNG): image/apng.static final StringAV1 Image File Format (AVIF): image/avif.static final MediaTypeAV1 Image File Format (AVIF): image/avif.static final StringBitmap file: image/bmp.static final MediaTypeBitmap file: image/bmp.static final StringGif Image: image/gif.static final MediaTypeGif Image: image/gif.static final StringJpeg Image: image/jpeg.static final MediaTypeJpeg Image: image/jpeg.static final StringPng Image: image/png.static final MediaTypePng Image: image/png.static final StringScalable Vector Graphics (SVG): image/svg+xml.static final MediaTypeScalable Vector Graphics (SVG): image/svg+xml.static final StringTagged Image File Format: image/tiff.static final MediaTypeTagged Image File Format: image/tiff.static final StringWebp Image: image/webp.static final MediaTypeWebp Image: image/webp.static final StringWMF Image: image/wmf.static final MediaTypeWMF Image: image/wmf.static final StringMicrosoft Icon: image/x-icon.static final MediaTypeMicrosoft Icon: image/x-icon.static final StringX Window System Bitmap file (XBM): image/xbm.static final MediaTypeX Window System Bitmap file (XBM): image/xbm.static final StringMicrosoft Excel's workbook files in use between 97-2003.static final StringXML: Microsoft Excel Open XML Spreadsheet (XLSX).static final MediaTypeXML: Microsoft Excel Open XML Spreadsheet (XLSX).static final MediaTypeMicrosoft Excel's workbook files in use between 97-2003.static final StringMicrosoft Powerpoint files in use between 97-2003.static final StringXML: Microsoft Powerpoint XML (PPTX).static final MediaTypeXML: Microsoft Powerpoint Open XML (PPTX).static final MediaTypeMicrosoft Powerpoint files in use between 97-2003.static final StringMicrosoft Word files in use between 97-2003.static final StringXML: Microsoft Word Open XML (DOCX).static final MediaTypeXML: Microsoft Word Open XML (DOCX).static final MediaTypeMicrosoft Word files in use between 97-2003.static final StringMulti part form data: multipart/form-data.static final MediaTypeMulti part form data: multipart/form-data.protected final Stringstatic final StringOpenDocument presentation: application/vnd.oasis.opendocument.presentation.static final MediaTypeOpenDocument presentation: application/vnd.oasis.opendocument.presentation.static final StringOpenDocument spreadsheet: application/vnd.oasis.opendocument.spreadsheet.static final MediaTypeOpenDocument spreadsheet: application/vnd.oasis.opendocument.spreadsheet.static final StringOpenDocument text: application/vnd.oasis.opendocument.text.static final MediaTypeOpenDocument text: application/vnd.oasis.opendocument.text.protected final Map<CharSequence,String> static final StringParameter"q".static final MediaTypeRTF format data: application/rtf.protected final Stringstatic final StringCSS: text/css.static final MediaTypeCSS: text/css.static final StringCSV: text/csv.static final MediaTypeCSV: text/csv.static final StringText ecmascript: text/ecmascript.static final MediaTypeText ecmascript: text/ecmascript.static final StringServer Sent Event: text/event-stream.static final MediaTypeServer Sent Event: text/event-stream.static final StringHTML: text/html.static final MediaTypeHTML: text/html.static final StringText javascript: text/javascript.static final MediaTypeText javascript: text/javascript.static final StringJSON: text/json.static final MediaTypeJSON: text/json.static final StringMarkdown: text/markdown.static final MediaTypeMarkdown: text/markdown.static final StringPlain Text: text/plain.static final MediaTypePlain Text: text/plain.static final StringXML: text/xml.static final MediaTypeXML: text/xml.static final MediaTypeTOML format data: application/toml.protected final Stringstatic final StringParameter"v".static final MediaTypeYANG format data: application/yang.static final MediaTypeZIP archive format: application/zip.static final MediaTypeZlib compressed data: application/zlib.static final MediaTypeZstd compressed data: application/zstd. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new media type for the given string.Constructs a new media type for the given string and extension.Constructs a new media type for the given string and extension.Constructs a new media type for the given string and parameters. -
Method Summary
Modifier and TypeMethodDescriptioncharcharAt(int index) booleanforExtension(String extension) Resolve theMediaTypefor the given file extension.static MediaTypeforFilename(String filename) Resolve theMediaTypefor the given file name.getName()getType()inthashCode()booleanstatic booleanisTextBased(String contentType) intlength()booleanDetermine if this requested content type can be satisfied by a given content type.booleanmatchesAllOrWildcardOrExtension(String matchExtension) Check if the extension matches.booleanmatchesExtension(String matchExtension) Check if the extension matches.booleanmatchesSubtype(String matchSubtype) Check if the subtype matches.booleanmatchesType(String matchType) Check if the type matches.static MediaTypeof(CharSequence mediaType) Create a newMediaTypefrom the given text.static MediaType[]of(CharSequence... mediaType) Create a newMediaTypefrom the given text.static MediaTypeCreate a new or get aMediaTypefrom the given text.orderedOf(CharSequence... values) Returns the ordered media types for the given values.orderedOf(List<? extends CharSequence> values) Returns the ordered media types for the given values.subSequence(int start, int end) toString()voidValidate this media type for sending as an HTTP header.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.CharSequence
chars, codePoints, isEmpty
-
Field Details
-
EXTENSION_JSON
Default file extension used for JSON.- See Also:
-
EXTENSION_XML
Default file extension used for XML.- See Also:
-
EXTENSION_PDF
Default file extension used for PDF.- See Also:
-
EXTENSION_XLSX
File extension used for Microsoft Excel Open XML Spreadsheet (XLSX).- See Also:
-
EXTENSION_XLS
File extension for Microsoft Excel's workbook files in use between 97-2003.- See Also:
-
EXTENSION_ODS
File extension for OpenDocument spreadsheets.- See Also:
-
EXTENSION_DOCX
File extension used for Microsoft Word Open XML document (DOCX).- See Also:
-
EXTENSION_DOC
File extension for Microsoft Word document files in use between 97-2003.- See Also:
-
EXTENSION_ODT
File extension for OpenDocument text files.- See Also:
-
EXTENSION_PPTX
File extension used for Microsoft Powerpoint Open XML document (PPTX).- See Also:
-
EXTENSION_PPT
File extension for Microsoft Powerpoint files in use between 97-2003.- See Also:
-
EXTENSION_ODP
File extension for OpenDocument presentation files.- See Also:
-
EXTENSION_GPX
File extension for GPS Exchange Format files.- See Also:
-
EXTENSION_ZIP
File extension for ZIP archive files.- See Also:
-
EXTENSION_GZIP
File extension for GZIP compressed files.- See Also:
-
EMPTY_ARRAY
Default empty media type array. -
ALL
A wildcard media type representing all types.- See Also:
-
ALL_TYPE
A wildcard media type representing all types. -
MULTIPART_FORM_DATA
Multi part form data: multipart/form-data.- See Also:
-
MULTIPART_FORM_DATA_TYPE
Multi part form data: multipart/form-data. -
APPLICATION_FORM_URLENCODED
Form encoded data: application/x-www-form-urlencoded.- See Also:
-
APPLICATION_FORM_URLENCODED_TYPE
Form encoded data: application/x-www-form-urlencoded. -
FORM
Shortcut forAPPLICATION_FORM_URLENCODED_TYPE. -
APPLICATION_XHTML
XHTML: application/xhtml+xml.- See Also:
-
APPLICATION_XHTML_TYPE
XHTML: application/xhtml+xml. -
APPLICATION_XML
XML: application/xml.- See Also:
-
APPLICATION_XML_TYPE
XML: application/xml. -
APPLICATION_JSON_GITHUB
JSON GitHub: application/vnd.github+json.- See Also:
-
APPLICATION_JSON_GITHUB_TYPE
JSON GitHub: application/vnd.github+json. -
APPLICATION_JSON_FEED
JSON Feed: application/feed+json.- See Also:
-
APPLICATION_JSON_FEED_TYPE
JSON Feed: application/feed+json. -
APPLICATION_JSON_PATCH
- See Also:
-
- JSON Patch JSON Patch: application/json-patch+json.
- Constant Field Values
-
APPLICATION_JSON_PATCH_TYPE
JSON Patch: application/json-patch+json. -
APPLICATION_JSON_MERGE_PATCH
- See Also:
-
- JSON Merge Patch JSON Merge Patch: application/merge-patch+json
- Constant Field Values
-
APPLICATION_JSON_MERGE_PATCH_TYPE
JSON Merge Patch: application/merge-patch+json. -
APPLICATION_JSON_PROBLEM
JSON Feed: application/problem+json.- See Also:
-
APPLICATION_JSON_PROBLEM_TYPE
JSON Feed: application/problem+json. -
APPLICATION_JSON_SCHEMA
JSON Schema: application/schema+json.- See Also:
-
APPLICATION_JSON_SCHEMA_TYPE
JSON Schema: application/schema+json. -
APPLICATION_JSON
JSON: application/json.- See Also:
-
APPLICATION_JSON_TYPE
JSON: application/json. -
APPLICATION_YAML
YAML: application/x-yaml.- See Also:
-
APPLICATION_YAML_TYPE
YAML: application/x-yaml. -
MICROSOFT_EXCEL_OPEN_XML
XML: Microsoft Excel Open XML Spreadsheet (XLSX).- See Also:
-
MICROSOFT_EXCEL_OPEN_XML_TYPE
XML: Microsoft Excel Open XML Spreadsheet (XLSX). -
MICROSOFT_EXCEL
Microsoft Excel's workbook files in use between 97-2003.- See Also:
-
MICROSOFT_EXCEL_TYPE
Microsoft Excel's workbook files in use between 97-2003. -
OPEN_DOCUMENT_SPREADSHEET
OpenDocument spreadsheet: application/vnd.oasis.opendocument.spreadsheet.- See Also:
-
OPEN_DOCUMENT_SPREADSHEET_TYPE
OpenDocument spreadsheet: application/vnd.oasis.opendocument.spreadsheet. -
MICROSOFT_WORD_OPEN_XML
XML: Microsoft Word Open XML (DOCX).- See Also:
-
MICROSOFT_WORD_OPEN_XML_TYPE
XML: Microsoft Word Open XML (DOCX). -
MICROSOFT_WORD
Microsoft Word files in use between 97-2003.- See Also:
-
MICROSOFT_WORD_TYPE
Microsoft Word files in use between 97-2003. -
OPEN_DOCUMENT_TEXT
OpenDocument text: application/vnd.oasis.opendocument.text.- See Also:
-
OPEN_DOCUMENT_TEXT_TYPE
OpenDocument text: application/vnd.oasis.opendocument.text. -
MICROSOFT_POWERPOINT_OPEN_XML
XML: Microsoft Powerpoint XML (PPTX).- See Also:
-
MICROSOFT_POWERPOINT_OPEN_XML_TYPE
XML: Microsoft Powerpoint Open XML (PPTX). -
MICROSOFT_POWERPOINT
Microsoft Powerpoint files in use between 97-2003.- See Also:
-
MICROSOFT_POWERPOINT_TYPE
Microsoft Powerpoint files in use between 97-2003. -
OPEN_DOCUMENT_PRESENTATION
OpenDocument presentation: application/vnd.oasis.opendocument.presentation.- See Also:
-
OPEN_DOCUMENT_PRESENTATION_TYPE
OpenDocument presentation: application/vnd.oasis.opendocument.presentation. -
APPLICATION_HAL_JSON
HAL JSON: application/hal+json.- See Also:
-
APPLICATION_HAL_JSON_TYPE
HAL JSON: application/hal+json. -
APPLICATION_HAL_XML
HAL XML: application/hal+xml.- See Also:
-
APPLICATION_HAL_XML_TYPE
HAL XML: application/hal+xml. -
APPLICATION_ATOM_XML
Atom: application/atom+xml.- See Also:
-
APPLICATION_ATOM_XML_TYPE
Atom: application/atom+xml. -
APPLICATION_VND_ERROR
VND Error: application/vnd.error+json.- See Also:
-
APPLICATION_VND_ERROR_TYPE
VND Error: application/vnd.error+json. -
APPLICATION_JSON_STREAM
JSON Stream: application/x-json-stream.- See Also:
-
APPLICATION_JSON_STREAM_TYPE
JSON Stream: application/x-json-stream. -
APPLICATION_OCTET_STREAM
BINARY: application/octet-stream.- See Also:
-
APPLICATION_OCTET_STREAM_TYPE
BINARY: application/octet-stream. -
APPLICATION_GRAPHQL
GraphQL: application/graphql.- See Also:
-
APPLICATION_GRAPHQL_TYPE
GraphQL: application/graphql. -
APPLICATION_GPX_XML
GPS Exchange Format: application/gpx+xml.- See Also:
-
GPX_XML_TYPE
GPS Exchange Format: application/gpx+xml. -
APPLICATION_ZIP
ZIP archive format: application/zip.- See Also:
-
ZIP_TYPE
ZIP archive format: application/zip. -
APPLICATION_GZIP
GZip compressed data: application/gzip.- See Also:
-
GZIP_TYPE
GZip compressed data: application/gzip. -
APPLICATION_YANG
YANG format data: application/yang.- See Also:
-
YANG_TYPE
YANG format data: application/yang. -
APPLICATION_CUE
CUE format data: application/x-cue.- See Also:
-
CUE_TYPE
CUE format data: application/x-cue. -
APPLICATION_TOML
TOML format data: application/toml.- See Also:
-
TOML_TYPE
TOML format data: application/toml. -
APPLICATION_RTF
RTF format data: application/rtf.- See Also:
-
RTF_TYPE
RTF format data: application/rtf. -
APPLICATION_ZLIB
Zlib compressed data: application/zlib.- See Also:
-
ZLIB_TYPE
Zlib compressed data: application/zlib. -
APPLICATION_ZSTD
Zstd compressed data: application/zstd.- See Also:
-
ZSTD_TYPE
Zstd compressed data: application/zstd. -
APPLICATION_PDF
PDF: application/pdf.- See Also:
-
APPLICATION_PDF_TYPE
PDF: application/pdf. -
TEXT_HTML
HTML: text/html.- See Also:
-
TEXT_HTML_TYPE
HTML: text/html. -
TEXT_CSV
CSV: text/csv.- See Also:
-
TEXT_CSV_TYPE
CSV: text/csv. -
TEXT_CSS
CSS: text/css.- See Also:
-
TEXT_CSS_TYPE
CSS: text/css. -
TEXT_XML
XML: text/xml.- See Also:
-
TEXT_XML_TYPE
XML: text/xml. -
TEXT_JSON
JSON: text/json.- See Also:
-
TEXT_JSON_TYPE
JSON: text/json. -
TEXT_JAVASCRIPT
Text javascript: text/javascript.- See Also:
-
TEXT_JAVASCRIPT_TYPE
Text javascript: text/javascript. -
TEXT_ECMASCRIPT
Text ecmascript: text/ecmascript.- See Also:
-
TEXT_ECMASCRIPT_TYPE
Text ecmascript: text/ecmascript. -
TEXT_PLAIN
Plain Text: text/plain.- See Also:
-
TEXT_PLAIN_TYPE
Plain Text: text/plain. -
TEXT_MARKDOWN
Markdown: text/markdown.- See Also:
-
TEXT_MARKDOWN_TYPE
Markdown: text/markdown. -
TEXT_EVENT_STREAM
Server Sent Event: text/event-stream.- See Also:
-
TEXT_EVENT_STREAM_TYPE
Server Sent Event: text/event-stream. -
IMAGE_APNG
Animated Portable Network Graphics (APNG): image/apng.- See Also:
-
IMAGE_APNG_TYPE
Animated Portable Network Graphics (APNG): image/apng. -
IMAGE_BMP
Bitmap file: image/bmp.- See Also:
-
IMAGE_BMP_TYPE
Bitmap file: image/bmp. -
IMAGE_X_ICON
Microsoft Icon: image/x-icon.- See Also:
-
IMAGE_X_ICON_TYPE
Microsoft Icon: image/x-icon. -
IMAGE_TIFF
Tagged Image File Format: image/tiff.- See Also:
-
IMAGE_TIFF_TYPE
Tagged Image File Format: image/tiff. -
IMAGE_AVIF
AV1 Image File Format (AVIF): image/avif.- See Also:
-
IMAGE_AVIF_TYPE
AV1 Image File Format (AVIF): image/avif. -
IMAGE_SVG
Scalable Vector Graphics (SVG): image/svg+xml.- See Also:
-
IMAGE_SVG_TYPE
Scalable Vector Graphics (SVG): image/svg+xml. -
IMAGE_XBM
X Window System Bitmap file (XBM): image/xbm.- See Also:
-
IMAGE_XBM_TYPE
X Window System Bitmap file (XBM): image/xbm. -
IMAGE_PNG
Png Image: image/png.- See Also:
-
IMAGE_PNG_TYPE
Png Image: image/png. -
IMAGE_JPEG
Jpeg Image: image/jpeg.- See Also:
-
IMAGE_JPEG_TYPE
Jpeg Image: image/jpeg. -
IMAGE_GIF
Gif Image: image/gif.- See Also:
-
IMAGE_GIF_TYPE
Gif Image: image/gif. -
IMAGE_WEBP
Webp Image: image/webp.- See Also:
-
IMAGE_WEBP_TYPE
Webp Image: image/webp. -
IMAGE_WMF
WMF Image: image/wmf.- See Also:
-
IMAGE_WMF_TYPE
WMF Image: image/wmf. -
CHARSET_PARAMETER
Parameter"charset".- See Also:
-
Q_PARAMETER
Parameter"q".- See Also:
-
V_PARAMETER
Parameter"v".- See Also:
-
name
-
subtype
-
type
-
extension
-
parameters
-
-
Constructor Details
-
MediaType
Constructs a new media type for the given string.- Parameters:
name- The name of the media type. For example application/json
-
MediaType
Constructs a new media type for the given string and parameters.- Parameters:
name- The name of the media type. For example application/jsonparams- The parameters
-
MediaType
Constructs a new media type for the given string and extension.- Parameters:
name- The name of the media type. For example application/jsonextension- The extension of the file using this media type if it differs from the subtype
-
MediaType
public MediaType(@NonNull @NonNull String name, @Nullable @Nullable String extension, @Nullable @Nullable Map<String, String> params) Constructs a new media type for the given string and extension.- Parameters:
name- The name of the media type. For example application/jsonextension- The extension of the file using this media type if it differs from the subtypeparams- The parameters
-
-
Method Details
-
of
Create a new or get aMediaTypefrom the given text.- Parameters:
mediaType- The text- Returns:
- The
MediaType
-
matches
Determine if this requested content type can be satisfied by a given content type. e.g. text/* will be satisfied by test/html.- Parameters:
expectedContentType- Content type to match against- Returns:
- if successful match
-
matchesSubtype
Check if the subtype matches.- Parameters:
matchSubtype- The subtype to match- Returns:
- true if matches
- Since:
- 4.6.3
-
matchesType
Check if the type matches.- Parameters:
matchType- The type to match- Returns:
- true if matches
- Since:
- 4.6.3
-
matchesAllOrWildcardOrExtension
Check if the extension matches.- Parameters:
matchExtension- The extension to match- Returns:
- true if matches
- Since:
- 4.7.0
-
matchesExtension
Check if the extension matches.- Parameters:
matchExtension- The extension to match- Returns:
- true if matches
- Since:
- 4.6.3
-
getName
- Returns:
- The name of the mime type without any parameters
-
getType
- Returns:
- The type of the media type. For example for application/hal+json this would return "application"
-
getSubtype
- Returns:
- The subtype. For example for application/hal+json this would return "hal+json"
-
getExtension
- Returns:
- The extension. For example for application/hal+json this would return "json"
-
getParameters
- Returns:
- The parameters of the media type
-
getParametersMap
- Returns:
- The parameters map of the media type
- Since:
- 4.8
-
getQuality
- Returns:
- The quality of the Mime type
-
getQualityAsNumber
- Returns:
- The quality in BigDecimal form
-
getVersion
- Returns:
- The version of the Mime type
-
getCharset
- Returns:
- The charset of the media type if specified
-
length
public int length()- Specified by:
lengthin interfaceCharSequence
-
charAt
public char charAt(int index) - Specified by:
charAtin interfaceCharSequence
-
subSequence
- Specified by:
subSequencein interfaceCharSequence
-
isTextBased
public boolean isTextBased()- Returns:
- Whether the media type is text based
-
isTextBased
- Parameters:
contentType- The content type- Returns:
- Whether the content type is text based
-
validate
Validate this media type for sending as an HTTP header. This is an optimization to only run the validation once if possible. If the validation function does not throw, future calls to this method will not call the validation function again.- Parameters:
r- Validation function
-
toString
- Specified by:
toStringin interfaceCharSequence- Overrides:
toStringin classObject
-
equals
Only the name is matched. Parameters are not included.
-
hashCode
public int hashCode() -
orderedOf
Returns the ordered media types for the given values.- Parameters:
values- The values- Returns:
- The media types.
- Since:
- 1.3.3
-
orderedOf
Returns the ordered media types for the given values.- Parameters:
values- The values- Returns:
- The media types.
- Since:
- 1.3.3
-
of
Create a newMediaTypefrom the given text.- Parameters:
mediaType- The text- Returns:
- The
MediaType
-
of
Create a newMediaTypefrom the given text.- Parameters:
mediaType- The text- Returns:
- The
MediaType
-
fromType
-
forExtension
Resolve theMediaTypefor the given file extension.- Parameters:
extension- The file extension- Returns:
- The
MediaType
-
forFilename
Resolve theMediaTypefor the given file name. Defaults to text/plain.- Parameters:
filename- The file name- Returns:
- The
MediaType
-