cancel
Showing results for 
Search instead for 
Did you mean: 

adding extension to an Alfresco mimetype

cszamudio
Champ on-the-rise
Champ on-the-rise
Hi,

I've been able to add additional mimetypes using the extension mechanism.  But, is it possible to add an additional file extension to an existing Alfresco mimetype (e.g., text/html) ? So far, the only way I've been able to do this is to edit the mimetype-map.xml, which of course is not advised.

Thanks.
Carlos S. Zamudio
4 REPLIES 4

abarisone
Star Contributor
Star Contributor
Hi Carlos,
I had to add the p7m extension to mimetype-map.xml and I managed to do this creating my own copy of the file and putting it into an AMP file.
In this way, every time I build and deploy my application, I always start from an official Alfresco war and then I add all the modifications using MMT.
In fact, when upgrading from Alfresco 3.3.g to 4.0.d, I only had to take care of AMP modifications to be correctly installed on top of the original Alfresco installation.

Hope this helps.
Regards,
Andrea

cszamudio
Champ on-the-rise
Champ on-the-rise
Thanks Andrea for taking the time to reply. Your solution sounds good to me.

I noticed that the documentation mentions the possibility of adding to the Tika definitions, by subclassing an existing mimetype. Did you explore this? There was not enough information in the description for me to try - like exactly where to place the new Tika file in the Alfresco folder hierarchy.

Thanks again.

amandaluniz_z
Champ on-the-rise
Champ on-the-rise
Hi Carlos,

As Andrea says you need to edit an XML file. There are different XML files you can edit the options are the following (extracted from alfresco config files)

<property name="locations">
                    <list>
                        <value>classpath:alfresco/mimetype/mimetype-map.xml</value>
                        <value>classpath:alfresco/mimetype/mimetype-map-openoffice.xml</value>
                        <value>classpath*:alfresco/module/*/mimetype-map*.xml</value>
                        <value>classpath*:alfresco/extension/mimetype/*-map.xml</value>
                    </list>
                </property>

So alfresco picks up all the files that match the regular expressions above.

cszamudio
Champ on-the-rise
Champ on-the-rise
Thank you. Yes, I've been able to create mimetypes by adding mimetype xml files via the extension directory. The problem I was describing was how to extend an existing mimetype, like HTML, with additional file extensions. . If I create a new mimetype in a custom file and call it HTML and add the extension, you get a duplicate error. Andrea's suggestion was (I believe) to edit the system mimetype file and use the AMP mechanism to overwrite it whenever an upgrade is performed.