public class MappingMediaTypeFileExtensionResolver extends Object implements MediaTypeFileExtensionResolver
MediaTypeFileExtensionResolver
that maintains
lookups between file extensions and MediaTypes in both directions.
Initially created with a map of file extensions and media types.
Subsequently subclasses can use addMapping(java.lang.String, org.springframework.http.MediaType)
to add more mappings.
Constructor and Description |
---|
MappingMediaTypeFileExtensionResolver(Map<String,MediaType> mediaTypes)
Create an instance with the given map of file extensions and media types.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addMapping(String extension,
MediaType mediaType)
Map an extension to a MediaType.
|
List<String> |
getAllFileExtensions()
Get all registered file extensions.
|
protected List<MediaType> |
getAllMediaTypes() |
Map<String,MediaType> |
getMediaTypes() |
protected MediaType |
lookupMediaType(String extension)
Use this method for a reverse lookup from extension to MediaType.
|
List<String> |
resolveFileExtensions(MediaType mediaType)
Resolve the given media type to a list of file extensions.
|
protected void addMapping(String extension, MediaType mediaType)
public List<String> resolveFileExtensions(MediaType mediaType)
MediaTypeFileExtensionResolver
resolveFileExtensions
in interface MediaTypeFileExtensionResolver
mediaType
- the media type to resolvenull
)public List<String> getAllFileExtensions()
MediaTypeFileExtensionResolver
getAllFileExtensions
in interface MediaTypeFileExtensionResolver
null
)