java.lang.Object
io.helidon.common.media.type.MediaTypes
Media type detection based on a resource.
The media type detection uses the following algorithm:
- Queries
MediaTypeDetector
services in priority order - Checks all
META-INF/media-types.properties
files on classpath for a mapping (suffix=media type) - Checks built-in mapping provided by Helidon (with the usual the web relevant media types)
-
Method Summary
Modifier and TypeMethodDescriptiondetectExtensionType
(String fileSuffix) Detecd media type for a specific file extension.detectType
(String fileName) Detect media type for a path (may be URL, URI, path on a file system).detectType
(URI uri) Detect media type based on URI.detectType
(URL url) Detect media type based on URL.detectType
(Path file) Detect media type for a file on file system.
-
Method Details
-
detectType
Detect media type based on URL. As there may be an infinite number of urls used in a system, the results are NOT cached.- Parameters:
url
- to determine media type for- Returns:
- media type or empty if none found
-
detectType
Detect media type based on URI. Results may not be cached.- Parameters:
uri
- to determine media type for- Returns:
- media type or empty if none found
-
detectType
Detect media type for a file on file system. Results may not be cached.- Parameters:
file
- file on a file system- Returns:
- media type or empty if none found
-
detectType
Detect media type for a path (may be URL, URI, path on a file system). Results may not be cached. If you haveURL
,URI
, orPath
please use the other methods on this class.- Parameters:
fileName
- any string that has a file name as its last element- Returns:
- media type or empty if none found
- See Also:
-
detectExtensionType
Detecd media type for a specific file extension. Results are cached.- Parameters:
fileSuffix
- suffix of a file, such astxt
,properties
, orjpeg
. Without the leading dot.- Returns:
- media type for the file suffix or empty if none found
-