Package org.eclipse.jetty.http
Class MimeTypes
java.lang.Object
org.eclipse.jetty.http.MimeTypes
- Direct Known Subclasses:
MimeTypes.Mutable
MIME Type enum and utilities
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static enum
Enumeration of predefined MimeTypes.static class
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetAssumedCharset
(String contentType) static MimeTypes.Type
getBaseType
(String contentType) getCharset
(String mimeType) Get the explicit, assumed, or inferred Charset for a mime typegetCharsetAssumedFromContentType
(String contentType) static String
getCharsetFromContentType
(String value) getCharsetInferredFromContentType
(String contentType) static String
getInferredCharset
(String contentType) static Charset
getKnownCharset
(String charsetName) getMimeByExtension
(String filename) Get the MIME type by filename extension.getMimeForExtension
(String extension) static boolean
isKnownLocale
(Locale locale) static String
normalizeCharset
(String charsetName) Convert alternate charset names (eg utf8) to normalized name (eg UTF-8).static String
normalizeCharset
(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
Convert alternate charset names (eg utf8) to normalized name (eg UTF-8).- Parameters:
charsetName
- the charset to normalize- Returns:
- the normalized charset (or null if normalized version not found)
-
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
Charset
for 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
Charset
or 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
Get the MIME type by filename extension.- Parameters:
filename
- A file name- Returns:
- MIME type matching the last dot extension of the file name, or matching "*" if none found.
-
getMimeForExtension
-
getInferredCharset
-
getAssumedCharset
-
getCharsetInferredFromContentType
-
getCharsetAssumedFromContentType
-
getMimeMap
-
getInferredMap
-
getAssumedMap
-
getCharsetFromContentType
-
getContentTypeWithoutCharset
-