Class MimeTypes
java.lang.Object
org.eclipse.jetty.http.MimeTypes
- Direct Known Subclasses:
MimeTypes.Mutable
MIME Type enum and utilities
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enumEnumeration of predefined MimeTypes.static class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAssumedCharset(String contentType) static MimeTypes.TypegetBaseType(String contentType) getCharset(String mimeType) Get the explicit, assumed, or inferred Charset for a mime typegetCharsetAssumedFromContentType(String contentType) static StringgetCharsetFromContentType(String value) getCharsetInferredFromContentType(String contentType) static StringgetInferredCharset(String contentType) static CharsetgetKnownCharset(String charsetName) getMimeByExtension(String filename) Get the MIME type by filename extension.getMimeForExtension(String extension) static booleanisKnownLocale(Locale locale) static StringnormalizeCharset(String charsetName) Convert alternate charset names (eg utf8) to normalized name (eg UTF-8).static StringnormalizeCharset(String charsetName, int offset, int length) Convert alternate charset names (eg utf8) to normalized name (eg UTF-8).
-
Field Details
-
ISO_8859_1
-
UTF8
-
UTF16
-
CACHE
-
_mimeMap
-
_inferredEncodings
-
_assumedEncodings
-
DEFAULTS
-
-
Constructor Details
-
MimeTypes
public MimeTypes() -
MimeTypes
-
-
Method Details
-
getBaseType
-
isKnownLocale
-
normalizeCharset
-
normalizeCharset
Convert alternate charset names (eg utf8) to normalized name (eg UTF-8).- Parameters:
charsetName- the charset to normalizeoffset- the offset in the charsetlength- the length of the charset in the input param- Returns:
- the normalized charset (or null if not found)
-
getKnownCharset
- Parameters:
charsetName- The name of the charset- Returns:
- The
Charsetfor the normalized name - Throws:
UnsupportedEncodingException- Thrown if the charset is not known to the JVM.
-
getCharset
public Charset getCharset(String mimeType) throws IllegalCharsetNameException, UnsupportedCharsetException Get the explicit, assumed, or inferred Charset for a mime type- Parameters:
mimeType- String form or a mimeType- Returns:
- A
Charsetor null; - Throws:
IllegalCharsetNameException- If the given charset name is illegalUnsupportedCharsetException- If no support for the named charset is available in this instance of the Java virtual machine
-
getMimeByExtension
-
getMimeForExtension
-
getInferredCharset
-
getAssumedCharset
-
getCharsetInferredFromContentType
-
getCharsetAssumedFromContentType
-
getMimeMap
-
getInferredMap
-
getAssumedMap
-
getCharsetFromContentType
-
getContentTypeWithoutCharset
-