Add New MimeType Support in Alfresco

Alfresco support many type of documents out of box. For the document type which is supported by alfresco it maintain the list of all supported mimetypes and whenever new document gets uploaded in the alfresco it will try to identify its document type with few of APIs of Apache tika and from the extension of file which is being uploaded. Once it identifies them it will set respective values on the User Interface and also invoke the respective meta-data extractor for particular mimetype from the repository. We had discussed about metadata extraction in my previous posts.

With the evolution in field of IT industries every day new type of file types are derived or created so it is virtually impossible for any of CMS to accommodate all the available mimetypes out of box. But the great thing about Alfresco is it has provided nice extension points for that though which we can add new mimetype which we want to be supported by Alfresco.

Adding mimetype support for new mimetype is the first step for creating custom metadata extractor for new mimetype as it enables alfresco to identify the incoming document and based on that it could invoke new extractor.

Steps to Add custom mime type

Add new mimetype in mimetype-extension-map.xml

<alfresco-config area="mimetype-map">   
   <config evaluator="string-compare" condition="Mimetype Map">
      <mimetypes>
             <mimetype mimetype="application/custom" display="Custom FileType">
			<extension>custom</extension>
		</mimetype>
      </mimetypes>
   </config>
   </alfresco-config>

Before version Alfresco 4.0 you need to follow below steps

override the mimetypeConfigService bean in an extension file

<extension>/alfresco/extension/custom-services-context.xml.

<bean id="mimetypeConfigService" 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>
Step 2:

Then you need to add following entry in the mimetype-custom-extensions.xml

<alfresco-config area="mimetype-map">  
   <config evaluator="string-compare" condition="Mimetype Map">
      <mimetypes>
             <mimetype mimetype="application/custom" display="Custom FileType">
                  <extension>custom</extension>
             </mimetype>
      </mimetypes>
   </config>
</alfresco-config>

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.

This is how you can add new file type to Alfresco.

Looking for quality Alfresco Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , , , , , | Posted under Alfresco | RSS 2.0

Author Spotlight

mitpatoliya

mitpatoliya

I love opensource technologies working with those technologies from the time I have stepped in to the Software Industry. Alfresco CMS is my area of expertise. I have worked on various complex implementations which involved integration of Alfresco with other technologies, extensively worked with JBPM workflows and Webscripts.

Leave a Reply

Your email address will not be published. Required fields are marked *


4 − 1 =

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>