Obsolete Pages{{Obsolete}}
The official documentation is at: http://docs.alfresco.com
Back to Server Configuration
By default, there are two files that currently contain mimetype definitions:
These are contained within the alfresco.war->repository.jar and should not be edited directly.
Mimetypes are defined in XML in 'mimetype-map files. These contain definitions for one or more mimetype, featuring the display name for the mimetype, and any file extensions it uses. The file is of the form:
<alfresco-config area='mimetype-map'>
<config evaluator='string-compare' condition='Mimetype Map'>
<mimetypes>
<mimetype mimetype='application/test' display='Example mimetype'>
<extension>ex</extension>
</mimetype>
<mimetype mimetype='application/test2' display='Another example'>
<extension default='true'>ex2</extension>
<extension>ex3</extension>
</mimetype>
</mimetypes>
</config>
</alfresco-config>
For more advanced file type detection than offered by file extensions alone, you should consider additionally defining your Mimetype to Apache Tika, and supplying custom Mime Magic for detection. See Adding Your MIME-Type for details on how to define custom mimetypes to Tika.
Instead, of editing the core mimetype files, override the mimetypeConfigService bean in an extension file, such as <extension>/alfresco/extension/custom-services-context.xml.
<bean id='mimetypeConfigService' class='org.alfresco.config.xml.XMLConfigService' init-method='init'>
<constructor-arg>
<bean class='org.alfresco.config.source.UrlConfigSource'>
<constructor-arg>
<list>
<value>classpath:alfresco/mimetype/mimetype-map.xml</value>
<value>classpath:alfresco/mimetype/mimetype-map-openoffice.xml</value>
<value>classpath:alfresco/mimetype/mimetype-custom-extensions.xml</value>
</list>
</constructor-arg>
</bean>
</constructor-arg>
</bean>
An example context file that does this is supplied in alfresco/extension/mimetype-map-extension-context.xml.sample
The UrlConfigService can load additional files such as:
Any number of additional files can be added to the list.
Before Alfresco 4.0.1, Share did not retrieve its list of mimetypes directly from Alfresco but processes them within alfresco\site-webscripts\org\alfresco\components\form\controls\mimetype.ftl. This file either needs to be updated to include your new mimetypes, or the instructions under the bug ticket should be followed
http://issues.alfresco.com/jira/brows.../ALF-8033, or you should upgrade to 4.0.1 for the fix.
This applies to Alfresco 4.0.1 and later, and Alfresco Community builds from r33865 onwards
To make including additional Mimetype Maps easier, Alfresco 4.0.1 has changed to automatically loading extension mimetype maps that match a filename. This mirrors the extension behaviour in other areas of Alfresco.
To have your map loaded, place it into the alfresco/extension/mimetype/ directory, with a name that ends with -map.xml . An example file is provided as alfresco/extension/mimetype/mimetypes-extension-map.xml.sample . Multiple files may be included this way.
If the file format for which you are adding the mimetype builds on top of one of the well-known filetypes already supported by both Alfresco and Apache Tika, you may wish to also add the mimetype to Apache Tika complete with the mimetypes hierarchy information. To do that, create a file org/apache/tika/mime/custom-mimetypes.xml and populate it with details of your mimetypes, in the FreeDesktop MIME-Info format. As an example, this what you'd add for a custom mimetype which is based on a zip file structure:
<mime-info>
<mime-type type='application/x-my-custom-zip-format'>
<_comment>My custom format which is built on top of ZIP</_comment>
<glob pattern='*.myformat' />
</mime-type>
</mime-info>
PS: To add mimetype custom mapping in a packaging (AMP or JAR), you should use the file: /META-INF/mimetype/mimetype-map-custom.xml.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.