public final class MediaTypeFactory
extends java.lang.Object
MediaType
objects
from Resource
handles or filenames.Modifier and Type | Method and Description |
---|---|
static java.util.Optional<MediaType> |
getMediaType(org.springframework.core.io.Resource resource)
Determine a media type for the given resource, if possible.
|
static java.util.Optional<MediaType> |
getMediaType(java.lang.String filename)
Determine a media type for the given file name, if possible.
|
static java.util.List<MediaType> |
getMediaTypes(java.lang.String filename)
Determine the media types for the given file name, if possible.
|
public static java.util.Optional<MediaType> getMediaType(@Nullable org.springframework.core.io.Resource resource)
resource
- the resource to introspectnull
if none foundpublic static java.util.Optional<MediaType> getMediaType(@Nullable java.lang.String filename)
filename
- the file name plus extensionnull
if none foundpublic static java.util.List<MediaType> getMediaTypes(@Nullable java.lang.String filename)
filename
- the file name plus extension