Class DefaultMimeMappingStrategy
java.lang.Object
de.hybris.platform.mediaconversion.imagemagick.DefaultMimeMappingStrategy
- All Implemented Interfaces:
MimeMappingStrategy
MimeMappingStrategy implementation backed by the hybris configuration (project.properties,
local.properties et. al.).
You can register further mime type mapping by adding the following properties:
- replace the slash (/) in your mimetype with a dot (.).
- add property
media.customextension.<mimetype>=<extension>to your properties
Example:
media.customextension.application.vnd.ms-excel=xls media.customextension.application.vnd.ms-powerpoint=ppt media.customextension.application.vnd.visio=vsd
See the advanced.properties for predefined mime types.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondetermineMimeTypeByFileName(String fileName) Determines the mime type by the file extension fo the given file name.fileExtensionForMimeType(String mimeType) Computes the file extension (e.g.Accesses theConfigurationServiceto use.voidsetConfigurationService(ConfigurationService configurationService) Sets theConfigurationServiceto use.
-
Field Details
-
PROPERTY_NAME_PREFIX
Configuration key prefix of mime type mappings.- See Also:
-
PROPERTY_FILEEXTENSION_PREFIX
The property to retrieve the mime type by a file extension.- See Also:
-
-
Constructor Details
-
DefaultMimeMappingStrategy
public DefaultMimeMappingStrategy()
-
-
Method Details
-
fileExtensionForMimeType
Computes the file extension (e.g. 'gif' for 'image/gif', 'jpg' for 'image/jpeg') for the given mimetype.- Specified by:
fileExtensionForMimeTypein interfaceMimeMappingStrategy- Parameters:
mimeType- the mime type to get the file extension for.- Returns:
- the file extension without a leading dot, or
nullif the specified mimeType is unknown or could not be mapped to a file extension. - See Also:
-
determineMimeTypeByFileName
Determines the mime type by the file extension fo the given file name.- Specified by:
determineMimeTypeByFileNamein interfaceMimeMappingStrategy- Parameters:
fileName- The name of the file withou path- Returns:
- The mime type or
nullif no such mimetype is registered. - See Also:
-
getConfigurationService
Accesses theConfigurationServiceto use.- Returns:
- the
ConfigurationServiceto use.
-
setConfigurationService
Sets theConfigurationServiceto use. This is a Spring IoC accessor.- Parameters:
configurationService- theConfigurationServiceto use.
-