Class DefaultMimeMappingStrategy
- java.lang.Object
-
- de.hybris.platform.mediaconversion.imagemagick.DefaultMimeMappingStrategy
-
- All Implemented Interfaces:
MimeMappingStrategy
public class DefaultMimeMappingStrategy extends java.lang.Object implements MimeMappingStrategy
MimeMappingStrategyimplementation backed by the hybris configuration (project.properties,local.propertieset. 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.propertiesfor predefined mime types.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPROPERTY_FILEEXTENSION_PREFIXThe property to retrieve the mime type by a file extension.static java.lang.StringPROPERTY_NAME_PREFIXConfiguration key prefix of mime type mappings.
-
Constructor Summary
Constructors Constructor Description DefaultMimeMappingStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringdetermineMimeTypeByFileName(java.lang.String fileName)Determines the mime type by the file extension fo the given file name.java.lang.StringfileExtensionForMimeType(java.lang.String mimeType)Computes the file extension (e.g.ConfigurationServicegetConfigurationService()Accesses theConfigurationServiceto use.voidsetConfigurationService(ConfigurationService configurationService)Sets theConfigurationServiceto use.
-
-
-
Field Detail
-
PROPERTY_NAME_PREFIX
public static final java.lang.String PROPERTY_NAME_PREFIX
Configuration key prefix of mime type mappings.- See Also:
- Constant Field Values
-
PROPERTY_FILEEXTENSION_PREFIX
public static final java.lang.String PROPERTY_FILEEXTENSION_PREFIX
The property to retrieve the mime type by a file extension.- See Also:
- Constant Field Values
-
-
Method Detail
-
fileExtensionForMimeType
public java.lang.String fileExtensionForMimeType(java.lang.String mimeType)
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:
MimeMappingStrategy.fileExtensionForMimeType(String)
-
determineMimeTypeByFileName
public java.lang.String determineMimeTypeByFileName(java.lang.String fileName)
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:
MimeMappingStrategy.determineMimeTypeByFileName(java.lang.String)
-
getConfigurationService
public ConfigurationService getConfigurationService()
Accesses theConfigurationServiceto use.- Returns:
- the
ConfigurationServiceto use.
-
setConfigurationService
public void setConfigurationService(ConfigurationService configurationService)
Sets theConfigurationServiceto use. This is a Spring IoC accessor.- Parameters:
configurationService- theConfigurationServiceto use.
-
-