java.lang.Object
org.htmlunit.util.MimeType
Utility class holding information about the association between MIME types and file extensions.
- Author:
- Marc Guillemot, Ronald Brill
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String"application/json".static final String"application/octet-stream".static final String"application/xhtml+xml".static final String"application/xml".static final String"image/gif".static final String"image/jpeg".static final String"image/png".static final String"text/css".static final String"text/html".static final String"text/javascript".static final String"text/plain".static final String"text/xml". -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetFileExtension(String contentType) Returns the preferred file extension for the given content type, or"unknown"if none is known.static booleanisJavascriptMimeType(String mimeType) Returns whether the given MIME type is a valid JavaScript MIME type according to RFC 9239.static booleanisObsoleteJavascriptMimeType(String mimeType) Returns whether the given MIME type is an obsolete JavaScript MIME type according to MIME Sniffing.
-
Field Details
-
TEXT_JAVASCRIPT
"text/javascript".- See Also:
-
APPLICATION_OCTET_STREAM
"application/octet-stream".- See Also:
-
APPLICATION_JSON
"application/json".- See Also:
-
APPLICATION_XHTML
"application/xhtml+xml".- See Also:
-
APPLICATION_XML
"application/xml".- See Also:
-
TEXT_CSS
"text/css".- See Also:
-
TEXT_HTML
"text/html".- See Also:
-
TEXT_XML
"text/xml".- See Also:
-
TEXT_PLAIN
"text/plain".- See Also:
-
IMAGE_GIF
"image/gif".- See Also:
-
IMAGE_JPEG
"image/jpeg".- See Also:
-
IMAGE_PNG
"image/png".- See Also:
-
-
Method Details
-
isJavascriptMimeType
Returns whether the given MIME type is a valid JavaScript MIME type according to RFC 9239.- Parameters:
mimeType- the type to check- Returns:
trueif the MIME type is a JavaScript MIME type
-
isObsoleteJavascriptMimeType
Returns whether the given MIME type is an obsolete JavaScript MIME type according to MIME Sniffing.- Parameters:
mimeType- the type to check- Returns:
trueif the MIME type is an obsolete JavaScript MIME type
-
getFileExtension
Returns the preferred file extension for the given content type, or"unknown"if none is known.- Parameters:
contentType- the MIME type- Returns:
- the file extension, or
"unknown"if not recognized
-