public class CustomMimeTypeResolver extends Object implements MimeTypeResolver
MimeTypeResolver
OSGi service that can map
a list of custom file extensions to their corresponding custom mime types, and vice versa.
Currently used to add image/nitf mime type support.Constructor and Description |
---|
CustomMimeTypeResolver() |
Modifier and Type | Method and Description |
---|---|
void |
destroy() |
HashMap<String,String> |
getCustomFileExtensionsToMimeTypesMap() |
String[] |
getCustomMimeTypes() |
HashMap<String,List<String>> |
getCustomMimeTypesToFileExtensionsMap() |
String |
getFileExtensionForMimeType(String mimeType)
Gets the file extension for the specific mime type.
|
String |
getMimeTypeForFileExtension(String fileExtension)
Gets the mime type for the specified file extension.
|
String |
getName()
Gets the name of the MimeTypeResolver.
|
int |
getPriority()
Gets the priority of the MimeTypeResolver.
|
String |
getSchema()
Gets the schema (if one exists) of the MimeTypeResolver.
|
boolean |
hasSchema()
Returns true if the MimeTypeResolver has a schema, meaning it is for text/xml mime types and
has a namespace to match on.
|
void |
init() |
static <K,V> HashMap<V,K> |
reverse(Map<K,V> map) |
void |
setCustomFileExtensionsToMimeTypesMap(HashMap<String,String> customFileExtensionsToMimeTypesMap) |
void |
setCustomMimeTypes(String customMimeTypes) |
void |
setCustomMimeTypes(String[] customMimeTypes) |
void |
setCustomMimeTypesToFileExtensionsMap(HashMap<String,List<String>> customMimeTypesToFileExtensionsMap) |
void |
setName(String name) |
void |
setPriority(int priority) |
void |
setSchema(String schema) |
public void init()
public void destroy()
public String getName()
MimeTypeResolver
getName
in interface MimeTypeResolver
public void setName(String name)
public boolean hasSchema()
MimeTypeResolver
hasSchema
in interface MimeTypeResolver
public String getSchema()
MimeTypeResolver
getSchema
in interface MimeTypeResolver
public void setSchema(String schema)
public int getPriority()
MimeTypeResolver
getPriority
in interface MimeTypeResolver
public void setPriority(int priority)
public String[] getCustomMimeTypes()
public void setCustomMimeTypes(String customMimeTypes)
public void setCustomMimeTypes(String[] customMimeTypes)
public HashMap<String,String> getCustomFileExtensionsToMimeTypesMap()
public void setCustomFileExtensionsToMimeTypesMap(HashMap<String,String> customFileExtensionsToMimeTypesMap)
public HashMap<String,List<String>> getCustomMimeTypesToFileExtensionsMap()
public void setCustomMimeTypesToFileExtensionsMap(HashMap<String,List<String>> customMimeTypesToFileExtensionsMap)
public String getFileExtensionForMimeType(String mimeType)
MimeTypeResolver
getFileExtensionForMimeType
in interface MimeTypeResolver
mimeType
- the mime typepublic String getMimeTypeForFileExtension(String fileExtension)
MimeTypeResolver
getMimeTypeForFileExtension
in interface MimeTypeResolver
fileExtension
- the file extension without the period in itThis work is licensed under a Creative Commons Attribution 4.0 International License.